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:
@@ -0,0 +1,10 @@
|
||||
The last merge, element by element: [3, 27, 38, 43] + [9, 10, 82]
|
||||
=================================================================
|
||||
|
||||
k=0 3 <= 9, take left 3 output [3]
|
||||
k=1 9 < 27, take right 9 output [3, 9]
|
||||
k=2 10 < 27, take right 10 output [3, 9, 10]
|
||||
k=3 27 <= 82, take left 27 output [3, 9, 10, 27]
|
||||
k=4 38 <= 82, take left 38 output [3, 9, 10, 27, 38]
|
||||
k=5 43 <= 82, take left 43 output [3, 9, 10, 27, 38, 43]
|
||||
k=6 left run empty, copy 82 output [3, 9, 10, 27, 38, 43, 82]
|
||||
Reference in New Issue
Block a user