Data Structures & AlgorithmsHardProduct Company SDE · graph round

Problem: Which statement about Dijkstra's algorithm using a binary heap with lazy deletion (pushing duplicate entries and skipping stale ones) is correct?

  1. A. It runs in O(E log E), which equals O(E log V) since E is at most V^2
  2. B. It requires a decrease-key operation, so the heap must be indexed
  3. C. It is correct only on unweighted graphs
  4. D. It runs in O(V^2) regardless of E

Correct answer: A. It runs in O(E log E), which equals O(E log V) since E is at most V^2

Lazy deletion pushes at most E entries, and log E is O(log V) when E is at most V^2. A decrease-key operation is not needed, which removes a common implementation complication.

More Coding Interview Problems questions

Exams that ask this topic