Worst Case
Insertion sort → O(n2
Merge sort → O(n log n)
Quick sort → O(n2)
Data Structures and Algorithms MCQ - Performance Analysis of Algorithms and Recurrences
1. Quicksort will take worst case, if the input is
in ascending order i.e Θ(n2)
2. Insertion sort runs in Θ(n) time.
88
In the following table, the left column contains the names of standard graph algorithms and the right column contains the time complexities of the algorithms. Match each algorithm with its time complexity.
| List-I | List-II | ||
| 1. | Bellman-Ford algorithm | A. | O(mlog n) |
| 2. | Kruskal's algorithm | B. | O(n3) |
| 3. | Floyd-Warshall algorithm | C. | O(nm) |
| 4. | Topological sorting | D. | O(n + m) |
Bellman ford = O(n*m)
Kruskal’s Alqo = O(m logn)
Floyd war shall = O(n3)
Topological sort = O(n+m)
In case of unweighted, undirected graphs, BFS gives
the most time efficient computation for shortest
path. It is guaranteed to find first shortest path


