[Tutor] Any ideas on designing an efficient algorithm for this problem?
Mats Wichmann
mats at wichmann.us
Sun Jun 25 13:37:23 EDT 2023
On 6/24/23 19:50, ThreeBlindQuarks via Tutor wrote:
>
> I am wondering if a sliding window protocol is a suitable way to find the top 100.
That's not a bad approach.
There's also an algorithm already in the standard library:
heapq.nlargest(100, array)
whether that's optimal for a billion records, I don't know, but the heap
sorting approach is usually considered pretty efficient.
More information about the Tutor
mailing list