Add quick-sort module: Lomuto and Hoare partition dry runs, comparison/swap/depth counts on sorted, reverse and all-equal input, random pivot, three-way partition, recursion into the smaller side, and the three 2015 programs re-run (one corrupts duplicates, one throws) (16 tests, 14 transcripts)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7Rercfj3dzDQowoFA
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
Comparisons / swaps / deepest recursion, n = 5000
|
||||
=================================================
|
||||
|
||||
n(n-1)/2 = 12,497,500 (what 'quadratic' means for this n)
|
||||
|
||||
input scheme comparisons swaps depth
|
||||
random LOMUTO_LAST 74,221 38,781 32
|
||||
random LOMUTO_RANDOM 72,503 32,022 27
|
||||
random HOARE_MIDDLE 86,170 14,464 27
|
||||
random THREE_WAY 114,975 46,953 26
|
||||
|
||||
already sorted LOMUTO_LAST 12,497,500 0 5,000
|
||||
already sorted LOMUTO_RANDOM 68,422 4,948 27
|
||||
already sorted HOARE_MIDDLE 66,807 0 14
|
||||
already sorted THREE_WAY 86,511 28,254 19
|
||||
|
||||
reverse sorted LOMUTO_LAST 12,497,500 2,500 5,000
|
||||
reverse sorted LOMUTO_RANDOM 71,483 31,556 28
|
||||
reverse sorted HOARE_MIDDLE 66,808 2,500 14
|
||||
reverse sorted THREE_WAY 86,142 28,030 19
|
||||
|
||||
all equal LOMUTO_LAST 12,497,500 0 5,000
|
||||
all equal LOMUTO_RANDOM 12,497,500 4,991 5,000
|
||||
all equal HOARE_MIDDLE 69,606 29,804 14
|
||||
all equal THREE_WAY 10,000 0 2
|
||||
|
||||
10 distinct keys LOMUTO_LAST 1,266,199 7,876 545
|
||||
10 distinct keys LOMUTO_RANDOM 1,266,490 14,752 542
|
||||
10 distinct keys HOARE_MIDDLE 77,651 25,334 21
|
||||
10 distinct keys THREE_WAY 35,969 14,705 7
|
||||
|
||||
Reference in New Issue
Block a user