Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

stable sort

A sort that keeps equal items in their original order.

A stable sort never reorders elements that compare equal; slice::sort and sort_by_key are stable, sort_unstable is not.

Examples

  • Sorting [("Ana", 30), ("Ben", 25), ("Cy", 30)] with sort_by_key(|p| p.1) keeps Ana before Cy; sort_unstable_by_key makes no such promise.

Read the full section →