Text Tools Jun 25, 2026

Why Stable Sorting Matters — Multi-Key Composition, Algorithm Stability, and the JavaScript Array.sort Change

A stable sort preserves the relative order of equal elements — which enables multi-key sorting by composing stable sorts. Sort by amount first, then by date (stable): the final result is ordered by date, with amount order preserved within each date. Here's which algorithms are stable (merge sort, Timsort, insertion sort) vs unstable (quicksort, heapsort), why JavaScript's Array.sort stability changed in 2018, and why numbers stored as text sort "10" before "2".

Text Tools Jun 17, 2026

Alphabetical Sort Order Isn't Universal: Locale Collation, Swedish Å, and Why Your Database Might Be Sorting Wrong

Alphabetical sort order isn't the same in every language — Swedish Å, Ä, Ö go at the end of the alphabet; German has two competing sort conventions for umlauts; Spanish ñ sits between n and o. Most sort tools and database defaults use Unicode code-point order, which is correct for English and wrong for nearly every other language. Here's what locale-sensitive collation actually is, how to configure it in SQL, JavaScript, and Python, and the case/accent-sensitivity dimensions on top of letter ordering.

Text Tools Jun 14, 2026

Natural Sort vs Lexicographic: Why "file10 Before file2" Happens Differently in Every Language, Database, and File Manager

"file10" sorting before "file2" isn't a bug specific to one tool — it's the default lexicographic behavior across most programming languages, while file managers typically default to natural sort, creating a common mismatch. Here's how Python, JavaScript, SQL ORDER BY, and spreadsheets each handle this differently, and why version-number sorting (SemVer) is a related but distinct problem with its own rules.

Text Tools Jun 10, 2026

Sort Orders Explained: Why "file10" Sorts Before "file2" and When It Matters

"file10" sorts before "file2" alphabetically — which is correct for strings but wrong for filenames. Here's natural sort vs lexicographic sort, locale-aware collation for multilingual names, multi-column SQL ORDER BY, and why stable vs unstable sort algorithms matter in practice.

Text Tools Jun 10, 2026

Sorting Algorithms Explained: Why the Choice Matters at Scale

Bubble sort handles 1,000 items fine but takes hours on 1 million. Quicksort handles both in milliseconds. Here's how common sorting algorithms actually work, why O(n log n) is the comparison sort lower bound, and what TimSort is doing inside Python and Java.

Text Tools Jun 6, 2026

Sort Lines — Sort Any List Alphabetically, Numerically, or by Length

Learn how to sort any text list alphabetically, numerically, by length, or randomly, why numerical sort differs from alphabetical for numbers, and how to use a free sort lines tool for any list.