85.5k views
1 vote
The best-time complexity for bubble sort is _____________.

A. O(1)
B. O(logn)
C. O(n)
D. O(nlogn)
E. O(n*n)

User Simpadjo
by
8.4k points

1 Answer

3 votes

Final answer:

The best-time complexity for bubble sort is O(n*n).

Step-by-step explanation:

The best-time complexity for bubble sort is O(n*n). Bubble sort is a simple sorting algorithm that compares adjacent elements and swaps them if they are in the wrong order. In the worst-case scenario, where the array is sorted in reverse order, bubble sort needs to compare and swap each element, resulting in a time complexity of O(n*n). For example, if we have an array of size 5, bubble sort would make 25 comparisons in the worst-case scenario.

User Adolf Garlic
by
8.7k points