Ask your own question, for FREE!
Computer Science 13 Online
OpenStudy (anonymous):

which sorting method works fastest: 1.randomized array 2.nearly sorted array 3.reversed 4.array with duplicates *(assume that it is a large array with like 100,000 numbers)

OpenStudy (anonymous):

nearly sorted

OpenStudy (anonymous):

no, i think u misunderstood my question. basically i need to do it 4 diff ways and seee hich one is the best for diff methods these are my answers: ranomized:best is: mergesort reverse:bubblesort nearly sorted:bubblesort duplicates: selectionsort

OpenStudy (anonymous):

what u wanna know?

OpenStudy (anonymous):

if my choices are correct/make sense/ like for a randomized array, it is sorted fastest using mergesort reverse is fastest with bubble...

OpenStudy (anonymous):

isnt reverse better with insertion sort?

OpenStudy (anonymous):

oh, ya, but thats not one of my choices.. i have buble sort,mege, selection

OpenStudy (anonymous):

use merge here because bubble sort will take more steps

OpenStudy (anonymous):

Of your choices, merge sort is by far the best. Quicksort is probably the other major alternative to have a look at. A cool one for arrays with only a small range of possible numbers is counting sort: http://en.wikipedia.org/wiki/Counting_sort

OpenStudy (anonymous):

Merge sort and Randomised Quicksort have running times of O(n lg n). Bubble sort and Selection sort is O(n^2) Now O(n lg n) is faster than O( n^2), for a large enough n. Hence, Merge sort and Quicksort beats Bubble and Selection sort. Also, Counting sort has linear running time O(n). So, that's even better that O(n lg n), but it's complex and a little hard to understand.

OpenStudy (anonymous):

http://www.sorting-algorithms.com/

OpenStudy (anonymous):

the url above tells me randomized -> merge sort revese -> shell sort nearly sorted->insertion sort duplicates -> quick sort, but insertion works quite good as well.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!