Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
14 lines
1017 B
Plaintext
14 lines
1017 B
Plaintext
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
|