delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/18/10:29:49

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: qsort's algorithm
Date: Wed, 18 Oct 2000 10:57:14 GMT
Organization: always disorganized
Lines: 18
Message-ID: <39ed81db.9884699@news.freeserve.net>
References: <tf4qusk3quottc52jj9cmuhmqlvk48cgm7 AT 4ax DOT com>
NNTP-Posting-Host: modem-63.wisconsin.dialup.pol.co.uk
X-Trace: newsg4.svr.pol.co.uk 971866635 12376 62.137.99.63 (18 Oct 2000 10:57:15 GMT)
NNTP-Posting-Date: 18 Oct 2000 10:57:15 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Damian Yerrick wrote:

> From what I understand of the C standard, qsort() can use any decent
> sorting algorithm.

Yes, the standard permits any decent sorting algorithm.
Or even an indecent one...

> Does DJGPP libc's qsort() have bad performance on
> already sorted data?

It sorts a sorted array faster than it sorts a typical unsorted
array.  Of course, straight insertion would be considerably faster
if you know in advance that the array is [nearly] sorted - but
you need to be really certain, because using straight insertion
on a large random array would take ages.

S.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019