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,11 @@
|
||||
Merge sort on a singly linked list
|
||||
==================================
|
||||
|
||||
before 38 -> 27 -> 43 -> 3 -> 9 -> 82 -> 10 -> null
|
||||
after 3 -> 9 -> 10 -> 27 -> 38 -> 43 -> 82 -> null
|
||||
same 7 node objects, relinked: true
|
||||
|
||||
1,000,000 random values: top-down and bottom-up both match Arrays.sort
|
||||
|
||||
split written with fast = head (instead of head.next), input 2 -> 1 -> null:
|
||||
java.lang.StackOverflowError
|
||||
Reference in New Issue
Block a user