8 ms·
lacker, there are infinite solutions to every problem, but if you want really to find a competitor to my algorithm that performs better you NEED to talk about a
by antirez 18y ago
lacker, there are infinite solutions to every problem, but if you want really to find a competitor to my algorithm that performs better you NEED to talk about algorithms not using more than O(1) for every new element processed.
To sort the set from time to time is not valid under this assumptions for example. This is going to be M log M.
Registers is O(M).
p.s. M here is the number of top-elements tracked.
- lacker 18y agoYou asked for algorithms that use constant memory. So M is a constant and M log M is constant too.