27 Sep
2016
27 Sep
'16
8:33 p.m.
Hi,
Yes, of course it has linear complexity, but the factors are much smaller. My test-case (which is more demanding than my use-case) with a (max heap) size of about 50'000 beats any (more intelligent) solution heads down. I'll just conclude with a quote: “In theory, theory and practice are the same. In practice, they are not.” When you have only 10 elements, you are free to do whatever you want, but as soon as you have a relevant amount, it is going to be hard to beat the std::heap because it is such an efficient data structure.
Have a nice day, Oswin