Your question is Explain Heaps and Implement. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Describe the heap (priority queue) data structure and implement it (e.g. insert and supporting operations).
Asked in the technical phone screen stage. This was a 45-minute online technical interview with a Verily engineer, with approximately 20 minutes allocated to describing and implementing a heap.
Implement heap_operations(operations). Each operation is ['insert', value], ['peek'], or ['extract_min']. Return the values produced by peek and extract_min, in order. Inputs will not peek or extract from an empty heap.
def heap_operations(operations):