From: John P. Linderman Date: Sat, 26 May 2001 13:27:19 +0000 (-0400) Subject: Re: [PATCH] Re: stability of sort()? X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=da0f776e6bd617a9fb506f2a9c8e5255b8527abc;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] Re: stability of sort()? Message-Id: <200105261727.NAA06654@raptor.research.att.com> p4raw-id: //depot/perl@10220 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 2fa645d..20714be 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -4291,11 +4291,11 @@ loop control operators described in L or with C. When C is in effect, C sorts LIST according to the current collation locale. See L. -Perl does B guarantee that sort is stable. (In a I sort the -relative order is preserved for elements where the sort comparison used -returns that they are equal.) 5.7 happens to use a mergesort, which is -stable, but 5.6 and earlier used quicksort, which is not. However, do not -assume that future perls will continue to use a stable sort such as mergesort. +Perl does B guarantee that sort is stable. (A I sort +preserves the input order of elements that compare equal.) 5.7 and +5.8 happen to use a stable mergesort, but 5.6 and earlier used quicksort, +which is not stable. Do not assume that future perls will continue to +use a stable sort. Examples: