Y
Hacker News
new
|
ask
|
show
|
jobs
by
shiandow
170 days ago
You can just use this algorithm but ignore everything after the first k elements. The algorithm still works if you don't store anything beyond the first k elements but just pretend they are there.