Embercode
✕
Heaps and Priority QueuesQuick quiz

Medians and indexed heaps

7 questions. Covers Indexed heap with decrease-key.

Questions 1 to 5 of 7

  1. 1. An IndexedMinHeap holds n items. What is the Big-O cost of one decrease_key call?
  2. 2. The two-heap RunningMedian method slides a window of size k across a list of n values. Roughly how many steps does the whole run take?
  3. 3. Why does RunningMedian::erase add a count to pending_ instead of removing the value from its heap at once?
  4. 4. In IndexedMinHeap, what does the pos_ array store?
  5. 5. What does this program print? ``cpp #include <iostream> int main() { int a = 1, b = 2; std::cout << (a + b) / 2 << ' ' << (a + b) / 2.0 << '\n'; } ``

5 question(s) left on this page.