what is worst case of bubble sort?
a) Log n
b) n. Log n
c) n
d) none of the above
Answers
Answered by
0
Answer:
None of the above
Step-by-step explanation:
Because, Bubble sort worst case complexity is
O(n^2)
Best case complexity is sigma(n)
Average case Complexity is theta(nlogn)
=>Bubble sort better suitable, If the list is already sorted.
=>Bubble Sorting algorithm is In-Place, because it tracks the adjacent elements of the list.
=>
Logic in Programming :-
for(int i=0;i<n-1;i++) {
for(int j=0;j<n-i-1;i++) {
Comparisions and swapping
}
}
Similar questions