GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Lazy-deletion Dijkstra (a new heap entry is pushed whenever a label improves; stale entries are skipped when popped) runs from A on the undirected graph AB 4, AC 8, BC 2, BD 5, CD 9, CE 10, DE 3, DF 11, EF 4, EG 7, FG 5, BG 20. How many entries are pushed into the heap in total, counting the initial one for A?

  1. A. 11
  2. B. 7
  3. C. 10
  4. D. 14

Correct answer: A. 11

Every vertex gets a first label once (7 pushes, including A), and four labels improve later: C (8 → 6), E (16 → 12), F (20 → 16) and G (24 → 19), each a new push. The total is 7 + 4 = 11 (and the heap is popped 11 times).

More Algorithms questions

Exams that ask this topic