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:
Explanation
Solution:
Sabse pehle har operation ki time complexity ko define karte hain:
-
(A) Bubble sort (worst case): O(n2)
-
(B) Deleting head node in singly linked list: O(1)
-
(C) Binary search: O(logn)
-
(D) Worst case of merge sort: O(nlogn)
Increasing Order (Chhote se bada):
O(1) < O(\log n) < O(n \log n) < O(n^2)
Iska matlab hai:
(B) < (C) < (D) < (A)
Right Answer:
(B), (C), (D), (A)