Algorithms
Sorting & Searching
GATE 2007
Easy
Which of the following sorting algorithms has the lowest worst-case complexity?
- Merge sort
- BBubble sort
- CQuick sort
- DSelection sort
Explanation
Merge sort's worst case is Θ(n log n). Bubble sort and selection sort are both Θ(n²) worst case, and quicksort's worst case is also Θ(n²) (e.g. already-sorted input with a naive pivot choice).
Source: GATE CS 2007 (2007)
This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.