Why aren't we all speaking LISP now?
Christian Tanzer
tanzer at swing.co.at
Fri May 11 02:34:03 EDT 2001
Tim Roberts <timr at probo.com> wrote:
> >Indeed, the point of teaching bubblesort is to teach *not to use*
> >bubblesort.
>
> I would have said "...to teach WHEN not to use bubblesort." There have
> been many times I needed to sort a list in some throaway utility when I
> knew the list was going to be limited in size. I KNOW I can write a
> bubblesort or insertion sort and get it right. I'd have to look up and
> debug a quicksort or a heapsort.
Read `WHEN not to use bubblesort' as `not ever'.
If your really have to implement a simple sort function yourself, a
straight insertion sort beats bubblesort any time and is actually
slightly simpler. The only thing speaking for bubblesort is a fancy
name.
--
Christian Tanzer tanzer at swing.co.at
Glasauergasse 32 Tel: +43 1 876 62 36
A-1130 Vienna, Austria Fax: +43 1 877 66 92
More information about the Python-list
mailing list