On Thu, Nov 15, 2001 at 05:22:26PM -0800, Curtis Poe wrote:
> --- Sidharth Malhotra <[EMAIL PROTECTED]> wrote:
> > While were on this, I'm taking an intro to Data Structures class and
> > were learning all about the different sorting methods ... Insertsort,
> > mergesort etc.  What kind of sorting method perl's sort() use?
> > 
> > Sid.
> 
> Sid,
> 
> Perl's sort function is a quicksort algorithm.  It used to rest on top
> of C's qsort function, but due to problems with differenent vendors
> offering slightly differing implementations (which sometimes caused
> Perl to coredump with a bad sort routine), Tom Horsley
> (http://home.att.net/~Tom.Horsley/) rewrote qsort and integrated it
> with Perl.

Perl is now using a mergesort which has some useful properties.  It was
written by Peter M. McIlroy and John P. Linderman, and you can find the
details with lots of comments in pp_ctl.c.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to