Arrange the following time complexities in increasing order.
(A). Bubble sort (worst case)
(B). Deleting head node in singly linked list
(C). Binary search
(D). Worst case of merge sort
Choose the correct answer from the options given below:
1. (A), (B), (C), (D)
2. (B), (C), (D), (A)
3. (B), (A), (D), (C)
4. (C), (B), (D), (A)
🎥 Video solution / Text Solution of this question is given below:
Step 1: Note the time complexities
(A) Bubble Sort (worst case): \(O(n^2)\)
(B) Deleting head node in singly linked list: \(O(1)\)
(C) Binary Search: \(O(\log n)\)
(D) Merge Sort (worst case): \(O(n \log n)\)
Step 2: Arrange in increasing order
\[
O(1)\;<\;O(\log n)\;<\;O(n \log n)\;<\;O(n^2)
\]
So:
\[
(B)\;<\;(C)\;<\;(D)\;<\;(A)
\]