These are quicksort for linked listings.
Yes, it's fast, just out of place. It corresponds to a high-level algorithm for quick sorting when changing a low-level implementation in accordance with the data structure of linked lists. This is why it quickly sorts related lists.
I would rather say that "quicksort was originally designed to work on site" than "real quicksort." There are many options for quick sorting, including choosing random points to avoid worse behavior, etc. This is a reasonable, clear definition of quicksort for linked lists.
This definition exactly matches how we teach quicksort to 16-year-old math students in the UK. (We study algorithms, not programming.) It really hides the purpose and design, so we donโt teach this detail, even though it is a million miles from learning functional programming or related lists. (This does not change the fact that a packet-switched local exchange algorithm is best when you have arrays of disruptive updates.)
There is a time penalty for this definition, as it iterates over the list twice for two subscriptions. Of course, you can rewrite this to a section, not a filter, but I argue that this is an optimization, not a change to the fundamental algorithm here, quicksort.
AndrewC Feb 09 '13 at 10:10 2013-02-09 10:10
source share