All mock tests are FREE till 31 December — register to save your progress
Unit 7 · Data Structures and Algorithms Paper 2 CS · November 2021

Match each graph algorithm with its time complexity (n vertices, m edges). List I: A. Bellman-Ford, B. Kruskal's algorithm, C. Floyd-Warshall, D. Topological sorting. List II: I. O(m log n), II. O(n³), III. O(n·m), IV. O(n + m).

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: A. A ‐ III, B ‐ I, C ‐ II, D ‐ IV

Explanation

Bellman–Ford is O(nm); Kruskal is O(m log n); Floyd–Warshall is O(n³); topological sort is O(n + m).

More Data Structures and Algorithms questions