Re: quicksort for linked list

From: Thomas Pornin (Thomas.Pornin@ens.fr)
Date: Fri Mar 09 2001 - 07:09:02 EST


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/



This archive was generated by hypermail 2b29 : Thu Mar 15 2001 - 21:00:10 EST