Messages in this thread | | | Date | Fri, 9 Mar 2001 13:09:02 +0100 | From | Thomas Pornin <> | Subject | Re: quicksort for linked list |
| |
In article <200103091152.MAA31645@cave.bitwizard.nl> you write: > Quicksort however is an algorithm that is recursive. This means that > it can use unbounded amounts of stack -> This is not for the kernel.
Maybe a heapsort, then. It is guaranteed O(n*log n), even for worst case, and non-recursive. Yet it implies a significantly larger amount of comparisons than quicksort (about twice, I think).
Insertion sort will be better anyway for small sets of data (for 5 or less elements).
--Thomas Pornin - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |