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,16 @@
|
||||
Heap solutions vs brute force on seeded random input (seed 2026)
|
||||
================================================================
|
||||
|
||||
problem trials disagreements
|
||||
1 k-th largest 5000 0
|
||||
2 k-th largest in a stream 2000 0
|
||||
3 top k frequent (heap, buckets) 5000 0
|
||||
4 k closest points 5000 0
|
||||
5 last stone weight 5000 0
|
||||
6 merge k sorted lists 3000 0
|
||||
7 running median 1000 0
|
||||
8 task scheduler (vs search) 1500 0
|
||||
9 meeting rooms 5000 0
|
||||
10 connect ropes (vs all pairings) 1000 0
|
||||
|
||||
the sort-once-and-fold shortcut was wrong on 375 of those 1000 rope sets
|
||||
Reference in New Issue
Block a user