engineering recuitment GATE CSE 2023-24 Test Series Algorithms Searching, Sorting and Hashing Sorting
Bubble sort algorithm takes O(n2) time to sort the given array. A modified bubble sort is implemented with an extra flag. If the list is already sorted, then the extra flag is used to skip the remaining passes. What is best case complexity of the above modified bubble sort?
1
O(n)
2
O(log n)
3
O(n2)
4
None of the above