RMQ algorithm
Heap