+ 4
Would replacing Bubble Sort by Quick Sort increase the Search speed?
4 Respostas
+ 5
BUBBLE SORT
===========
Worst Time Complexity: O(n^2)
Best Time Complexity: O(n)
Space Complexity: O(1)
QUICK SORT
==========
Worst Complexity: O(n^2)
Best Time Complexity: O(n log n)
Space Complexity: O(1)
From this you can see depending on your input, using quick sort might help. Also using quick sort can be faster in the best case whereas in bubble sort for the best case will give slower sorting.
Remember,
Best Case represents, already sorted.
Worst Case represents, sorted in opposite.
If you are looking for more faster sorting, then you can use Linear search, Tournament Method or Paris Comparison.
Refer: www.geeksforgeeks.org/maximum-and-minimum-in-an-array/amp/
If have any questions, feel free to ask.
+ 2
Martin Taylor Agree. Loading stack frames for Quick Sort seems to be overkill. Swapping values on a single stack appears to have low overhead, in Bubble Sort. IMHO Indirection may help....Do you agree?