Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 11 May 2011 07:07:35 -0500 Message-ID: <4DCA7C09.303D@mindspring.com> Date: Wed, 11 May 2011 08:07:37 -0400 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.unix.programmer,comp.lang.c Subject: Re: Avoiding recursive stack overflow in C on Unix/Linux? References: <2f33e674-b127-4c35-89b5-dcbf564f3aab@h36g2000pro.googlegroups.com> <92rabuF51pU6@mid.individual.net> <87zkmvhyqm.fsf@temporary-address.org.uk> <87aaeui0ic.fsf@temporary-address.org.uk> <4DCA00CF.3150@mindspring.com> <4dca7740$0$81481$e4fe514c@news.xs4all.nl> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 49 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.223.42 X-Trace: sv3-CPG5DoczxZThvvdF883L2Kd46Noj0vgCl1S60fWah4yzIr5uQwmUPTYpFlBVRTGb0+1+cmzw3BGtcO+!I8kHbXvQJvpV6dzkL+OwoOOr6brcgogtr7yL7ygWG92Jqp/35PxEgQA+1/8BakJ4+vtfTd+rxK7q!Q3ToT1PmEQ== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3895 Xref: x330-a1.tempe.blueboxinc.net comp.unix.programmer:525 comp.lang.c:3744 Casper H.S. Dik wrote: > > pete writes: > > >Michael Press wrote: > > > >> I could dash off qsort. Its only advantage is speed. > >> When I want an O(n.log n) search I write heapsort. > >> > >> By the way, qsort(3) has an irremediable security hole. > > >I like to write sort functions with a qsort interface. > > >http://www.mindspring.com/~pfilandr/C/q_sort/ > > There is no rule that qsort() is actually a quick sort. The fastest ones that I have are either quicksort or variations on quicksort. But most of the sort functions that I have in that directory aren't quicksort. http://www.mindspring.com/~pfilandr/C/q_sort/pt_sort.c slsort, "Nonstable simple selection sort:", \ b_sort, "Stable bubble sort:", \ i_sort, "Stable insertionsort:", \ bisort, "Stable binary insertion sort:", \ s0sort, "Nonstable Shell sort \n" \ "with original Shell increment scheme:", \ shsort, "Nonstable Shell sort \n" \ "with Sedgewick increment scheme:", \ hdsort, "Nonstable double sift down heapsort:", \ h_sort, "Nonstable sift down and up heapsort:", \ lqsort, "Nonstable Lomuto style quicksort:", \ q1sort, "Nonrecursive Lomuto style quicksort:", \ sqsort, "Nonstable Sedgewick style quicksort:", \ q2sort, "Nonrecursive Sedgewick style quicksort:", \ qrsort, "Random pivot introspective quicksort:", \ mqsort, "Nonstable quicksort, (nmemb / 2) median:", \ sfsort, "Leapfropg sample quicksort:", \ m_sort, "Stable merge sort uses half buffer:", \ rcsort, "Stable, array of pointers and full buffer:", \ ipsort, "Stable merge, uses two arrays of pointers:", \ llsort, "Stable merge sort uses linked list:", \ -- pete