Computer Science EngineeringHard

Prim's algorithm on a graph stored as an adjacency matrix with a simple array for minimum selection runs in

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

Correct answer: B. O(V^2)

Each of V iterations scans O(V) vertices to pick the minimum and update keys.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic