Computer Science EngineeringHard
The Floyd-Warshall all-pairs shortest path algorithm runs in time
- A. O(V^2)
- B. O(V^3)
- C. O(V E)
- D. O(V^2 log V)
Correct answer: B. O(V^3)
It uses three nested loops over the V vertices.
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
- What does f(4795) return for int f(int n){ return n==0 ? 0 : n%10 + f(n/10); }
- A union-find structure with union by rank and path compression supports each operation in amortized time
- The number of inversions in the array [3, 1, 2, 5, 4] is
- A full binary tree (every node has 0 or 2 children) has 20 leaves. How many internal nodes does it have?
- A circular queue is stored in an array of size 8 and uses the convention (rear+1) mod 8 == front for 'full'. Maximum number of elements it…
- For the pattern ABABACA, the KMP longest-proper-prefix-which-is-also-suffix value at the last position is