Data Structures & AlgorithmsHardGoogle · Flipkart interview

What is the running time of Dijkstra's algorithm with a Fibonacci heap on a graph with V vertices and E edges?

  1. A. O((V + E) log V)
  2. B. O(E + V log V)
  3. C. O(V²)
  4. D. O(E log E)

Correct answer: B. O(E + V log V)

decrease-key is O(1) amortised in a Fibonacci heap, so the E relaxations cost O(E), while V extract-min operations cost O(log V) each. A binary heap gives O((V + E) log V), and the array version O(V²), which is better for very dense graphs than a binary heap.

More Coding Interview Problems questions

Exams that ask this topic