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,16 @@
|
||||
Lomuto vs Hoare on random distinct-ish keys (seed 7)
|
||||
====================================================
|
||||
|
||||
n scheme comparisons swaps
|
||||
1,000 LOMUTO_LAST 10,128 4,547
|
||||
1,000 HOARE_MIDDLE 15,679 2,301
|
||||
Hoare used 0.51x the swaps of Lomuto
|
||||
|
||||
10,000 LOMUTO_LAST 155,168 66,283
|
||||
10,000 HOARE_MIDDLE 193,958 30,750
|
||||
Hoare used 0.46x the swaps of Lomuto
|
||||
|
||||
100,000 LOMUTO_LAST 2,050,086 1,016,714
|
||||
100,000 HOARE_MIDDLE 2,377,190 387,156
|
||||
Hoare used 0.38x the swaps of Lomuto
|
||||
|
||||
Reference in New Issue
Block a user