Object-Oriented Programming · Amazon · Medium
Build a min-priority queue that stores integers. You may not rely on any priority-queue or heap facility from your language's standard library; the structure must be written by hand as a binary min-heap kept in an array, and both push and pop are required to finish in $$O(\log n)$$ time. The queue must handle four commands: push x: add the integer x to the queue. peek: print the smallest value currently stored, or print EMPTY when the queue holds nothing. pop: delete the…