Add merge-sort module: top-down and bottom-up merge sort, dry runs, stability, comparison counts against the exact worst case, linked lists, counting inversions, quick sort and TimSort comparisons, and the 2015 program re-run (unstable on ties, quadratic allocation) (17 tests, 15 transcripts)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6vDJ5fWY5uEZaJFNi
This commit is contained in:
Claude
2026-12-03 23:34:17 +05:30
parent 5419e5057d
commit 5ed8dca130
42 changed files with 1710 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
Top-down merge sort on [38, 27, 43, 3, 9, 82, 10]: merges in execution order
============================================================================
1. a[0..1] [38] + [27] -> [27, 38] 1 comparisons
array now [27, 38, 43, 3, 9, 82, 10]
2. a[2..3] [43] + [3] -> [3, 43] 1 comparisons
array now [27, 38, 3, 43, 9, 82, 10]
3. a[0..3] [27, 38] + [3, 43] -> [3, 27, 38, 43] 3 comparisons
array now [3, 27, 38, 43, 9, 82, 10]
4. a[4..5] [9] + [82] -> [9, 82] 1 comparisons
array now [3, 27, 38, 43, 9, 82, 10]
5. a[4..6] [9, 82] + [10] -> [9, 10, 82] 2 comparisons
array now [3, 27, 38, 43, 9, 10, 82]
6. a[0..6] [3, 27, 38, 43] + [9, 10, 82] -> [3, 9, 10, 27, 38, 43, 82] 6 comparisons
array now [3, 9, 10, 27, 38, 43, 82]
total: 6 merges, 14 comparisons