0Pricing
Go Academy · Lesson

Stable Sorting

Preserve equal-element order.

What Is Stable Sorting

A stable sort keeps equal elements in their original relative order. If two records compare equal, the one that came first stays first.

Why It Matters

Stability matters when you sort by one field but want a previous order preserved for ties. For example, sort by city, keeping people alphabetical within each city.

All lessons in this course

  1. Sorting Slices
  2. Custom Sort Orders
  3. Searching Sorted Data
  4. Stable Sorting
← Back to Go Academy