I want to pass and return CArray object with Function how can i implement this Thanks -Renugopal
ReplyOriginally posted by: Azlie.Syawal
why don't you put more example of sorting program that simple to learn and understand.All include with notes..
hope you will concern my opinion.bye
Originally posted by: Dominic
On average qsort is O(N log N) , infact with a 99:1 split mathematically it is still O(N log N) and because it sorts in place it is often the fastest algorithm. Heap sort may be guarenteed O(N log N), but there is a large overhead associated with maintaining the heap and hence it is often slower than qsort with random pivot selection.
ReplyOriginally posted by: Marc
I'm using the template and until now I thougt, that it is a great help. But now I found out, that the algorithm not always finds the smalles element in a list, if I sort it in ascending order. It seems to be, that the algorithm sets the second smallest object as the smallest. Does anybody made similar experiences ??
Originally posted by: Alex H
Is it possible to somehow use this sort function with a CArray <MyClass, MyClass> MyClassArray where MyClass contains an int to sort on. Of course MyClass also contains other variables that must remain with the int in MyClass.
Thanks,
alexh1@sbcglobal.net
ReplyOriginally posted by: John G
Not often you find exactly what you were looking for on the net. your search template method was exactly what i was looking for. i modified it to not modify the passed in array but modify an indexes array instead, but it works perfect!
Originally posted by: Jack Calhoun
I can't go into too much detail, because I havent written a paper to take credit. I just wrote it this morning.
Results averaged over 100 executions each:
Sorting 100 random Numbers between 1 and 100,000
avg = 168 comparisons
Sorting 250 random Numbers between 1 and 100,000
avg = 418 comparisons
Sorting 500 random Numbers between 1 and 100,000
avg = 834 comparisons
Sorting 1000 random numbers between 1 and 100,000
avg = 1,675 comparisons
Sorting 2000 random numbers between 1 and 100,000
avg = 3,331 comparisons
Sorting 4000 random numbers between 1 and 100,000
avg = 6,676 comparisons
Sorting 8000 random numbers between 1 and 100,000
avg = 13,102 comparisons
Reply
Originally posted by: Robert Vogt IV
QuickSort is not the fastest sorting algorithm. QuickSort should also never be used in arrays with more than 256 elements.
The two fastest sorting algorithms, for both large and small arrays, are Heap Sort and Merge Sort. (Heap Sort is guaranteed NlogN order, while QuickSort can become quadratic.)
Finally, QuickSort was one of the first sorting algorithms with much of an advantage over Bubble Sort. However, newer sorting mechanisms have made it practically useless for modern-day sorting (millions or billions of elements).
-Robert Vogt IV
Originally posted by: Martin Ziacek
My old e-mail is no longer valid. New: Martin.Ziacek@pobox.sk
ReplyOriginally posted by: CMan
please send me the advantages of heep sort over qsort in terms of time and swaps saving
my email is
andy_dharia@hotmail.com