Skip to content
Mad4Study

Engineering & Science

GATE Computer Science

  • GATE CS
  • 2026–27 pattern practice
  • Algorithms
  • Graph algorithms
  • Easy

Dijkstra's algorithm implemented with a binary min-heap on a graph with V vertices and E edges runs in

Algorithm Design

Pick an option to check your answer.

There are VV extract-min operations and up to EE decrease-key operations, each O(log⁡V)O(\log V) on a binary heap: O((V+E)log⁡V)O((V + E)\log V).

Why not the others

  • O(V2)O(V^2) only is the simple array implementation; good for dense graphs but not the heap version.
  • O(E+V)O(E + V) is BFS on unweighted graphs.
  • O(VE)O(VE) is Bellman–Ford.

Report an error

GATE CS · Algorithms · Algorithm Design