Hacker News new | ask | show | jobs
by navinp1912 4720 days ago
If you move what while (topK--) into the map loop , it becomes an online code for topK whereas what you wrote is an offline . If you want offline then pushing it into a priority_queue and then popping it out would be much faster.