Binary heap

medium

No pointers anywhere - node i's children are at 2i+1 and 2i+2. Push, pop, and build a heap from an arbitrary array in O(n) rather than O(n log n).

Best O(1) peekAverage O(log n)Worst O(log n)Space O(n)
Loading the binary heap engine…

Where to go next