Computer Science EngineeringHard
Prim's algorithm on a graph stored as an adjacency matrix with a simple array for minimum selection runs in
- A. O(E log V)
- B. O(V^2)
- C. O(V^3)
- D. O(E)
Correct answer: B. O(V^2)
Each of V iterations scans O(V) vertices to pick the minimum and update keys.
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- The postfix form of the infix expression a + b c - d is
- The length of a longest common subsequence of ABCBDAB and BDCABA is
- The 0/1 knapsack problem with n items and capacity W is solved by dynamic programming in time
- A red-black tree with n internal nodes has height at most
- The Floyd-Warshall all-pairs shortest path algorithm runs in time
- What does f(4795) return for int f(int n){ return n==0 ? 0 : n%10 + f(n/10); }