From: Sinan_Unur AT mail DOT com (A. Sinan Unur) Newsgroups: comp.os.msdos.djgpp Subject: qsort vs QuickSort (was Re: Peculiar behavior of program.) Date: 29 Jun 2001 08:05:39 -0700 Organization: http://groups.google.com/ Lines: 26 Message-ID: <426926da.0106290704.58345944@posting.google.com> References: <3b37e2d6 DOT 287121289 AT news DOT primus DOT ca> <9h9ich$jhe$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <3b3b43a3 DOT 210697691 AT news DOT primus DOT ca> <9hfqbt$g8b$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <3b3be472 DOT 251871236 AT news DOT primus DOT ca> NNTP-Posting-Host: 128.253.251.163 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 993827141 24215 127.0.0.1 (29 Jun 2001 15:05:41 GMT) X-Complaints-To: groups-support AT google DOT com NNTP-Posting-Date: 29 Jun 2001 15:05:41 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com invalid AT erehwon DOT invalid (Graaagh the Mighty) wrote in message news:<3b3be472 DOT 251871236 AT news DOT primus DOT ca>... > >Just because it's called qsort() by no means implies that the > >implementation is QuickSort. In the case of DJGPP, it isn't. > > Oops, I forgot: just because it's called libc by no means implies that > it's ANSI C. :P ANSI C imposes no such requirement. The algorithm does not matter. What matters is that the implementation behaves in the following way: (quoting from http://www.dinkumware.com/htm_cl/stdlib.html#qsort) "The function sorts, in place, an array consisting of nelem elements, each of size bytes, beginning with the element whose address is base. It calls the comparison function whose address is cmp to compare pairs of elements. The comparison function must return a negative value if e1 is less than e2, zero if the two are equal, or a positive value if e1 is greater than e2. Two array elements that are equal can appear in the sorted array in either order." Sinan. -- A. Sinan Unur http://www.unur.com/