sort the given list by using selection sort in descending order given s:- 32 51 27 85 66 23 13 57 55 45 also write algorithm for same and calculate. the time complexity for the selection sort
Answers
Answered by
2
The total number of comparisons, therefore, is (n - 1) + (n - 2)... (2) + (1) = n(n - 1)/2 or O(n2). The best case for bubble sort occurs when the list is already sorted or nearly sorted. In the case where the list is already sorted, bubble sort will terminate after the first iteration, since no swaps were made.
Similar questions