What is the best algorithm to sort a million 32 bit integers (each unique and ranging from 1-1000000)? I think timsort does it, but how does quicksort or mergesort or some other sorting algorithm compare with respect to the task?
CS question?
Yeah.
so post it there :P
but maybe JamesJ knows the answer.
you can ask him in chat! tadam
because Mathematics and Computer Science are like non-identical twins.
.... siblings! that's the word
BINARY SEARCH WOULD BE THE MOST SUITABLE FOR SUCH A LARGE NUMBER OF DATA
It won't be effective on an unsorted list :-P
The task is to sort a list, not to search for an element in the list.
oh, sorry! for sorting, i think quick sort would be good....
you check it @ http://en.wikipedia.org/wiki/Sorting_algorithm to view which on is more effective on what basis
don't think! justify! :D
every sorting algorithms have few advantages and many disadvantages.....you can compare all the algorithms which one is more effective on what basis @ wikipedia http://en.wikipedia.org/wiki/Sorting_algorithm
I think timsort would be the way to go: http://svn.python.org/projects/python/trunk/Objects/listobject.c
that code is for Lists in Python (written in C)
Join our real-time social learning platform and learn together with your friends!