I've found myself a nice description of how QuickSort works,
http://www.equestionanswers.com/c/c-quick-sort.php
put in in a(n assembly) program and, as a test, used it on a (worst case) reverse-sorted list.
It turned out to be painfully slow (taking many seconds)... :-( I could see the "high" marker move down one step at the time, making it a very time-consuming, lineair-is process.
In comparision DPA_Sort sorts the above list in a fraction of a second.
What can I do / have I missed ?
Hello all,
I've found myself a nice description of how QuickSort works,
http://www.equestionanswers.com/c/c-quick-sort.php
put in in a(n assembly) program and, as a test, used it on a (worst case) reverse-sorted list.
It turned out to be painfully slow (taking many seconds)... :-( I could see the "high" marker move down one step at the time, making it a very time-consuming, lineair-is process.
In comparision DPA_Sort sorts the above list in a fraction of a second.
What can I do / have I missed ?
For things like this -- algorithms and such -- I always suggest
checking Rosetta Code:
Quicksort has pathological cases. A reverse-sorted list is one of them.
https://www.geeksforgeeks.org/when-does-the-worst-case-of-quicksort-occur/
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 42:13:48 |
Calls: | 8,141 |
Calls today: | 4 |
Files: | 13,085 |
Messages: | 5,857,793 |