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
@@ -0,0 +1,20 @@
Element comparisons. random = new Random(7).nextInt(); worst = built by Data.worstCase
======================================================================================
n input top-down bottom-up skip-sorted worst bound
1,000 random 8,742 8,734 9,437 8,977
1,000 sorted 5,044 5,052 999 8,977
1,000 reversed 4,932 4,932 5,931 8,977
1,000 worst 8,977 8,976 9,976 8,977
1,024 random 8,963 8,963 9,634 9,217
1,024 sorted 5,120 5,120 1,023 9,217
1,024 reversed 5,120 5,120 6,143 9,217
1,024 worst 9,217 9,217 10,240 9,217
100,000 random 1,536,818 1,566,951 1,596,193 1,568,929
100,000 sorted 853,904 877,968 99,999 1,568,929
100,000 reversed 815,024 815,024 915,023 1,568,929
100,000 worst 1,568,929 1,585,582 1,668,928 1,568,929
1,048,576 random 19,646,187 19,646,187 20,337,833 19,922,945
1,048,576 sorted 10,485,760 10,485,760 1,048,575 19,922,945
1,048,576 reversed 10,485,760 10,485,760 11,534,335 19,922,945
1,048,576 worst 19,922,945 19,922,945 20,971,520 19,922,945