Add heap module: array min/max heap with dry runs and bottom-up heapify, PriorityQueue comparators and traps, heap sort, 10 interview problems with brute-force cross-checks (17 tests, 23 transcripts)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
The k largest of n = 1,000,000 distinct ints: comparisons
|
||||
=========================================================
|
||||
|
||||
input k sort everything min-heap of size k max-heap all, poll k
|
||||
random 10 18,641,233 1,000,758 1,882,132
|
||||
ascending 10 999,999 6,937,439 2,000,353
|
||||
descending 10 999,999 1,000,009 1,000,379
|
||||
random 1,000 18,641,233 1,131,903 1,919,594
|
||||
ascending 1,000 999,999 19,934,399 2,037,781
|
||||
descending 1,000 999,999 1,006,987 1,037,851
|
||||
random 500,000 18,641,233 14,144,364 20,315,500
|
||||
ascending 500,000 999,999 19,451,423 20,856,134
|
||||
descending 500,000 999,999 8,975,732 19,421,238
|
||||
Reference in New Issue
Block a user