Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.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, 06 Jun 2012 18:49:44 -0500 Message-ID: <4FCFEC9A.C74@mindspring.com> Date: Wed, 06 Jun 2012 19:49:46 -0400 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: Breakthrough References: <4FCD273B.5095@mindspring.com> <4fcdb0ef$0$6481$426a74cc@news.free.fr> <4FCEDA85.66BA@mindspring.com> <4FCF56CD.962@mindspring.com> <98pus75mg8q054gcv696u78gvg7gs6h1nk@4ax.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 39 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.220.251 X-Trace: sv3-TfKjOY7KC5ZvYlhCL1GQy4alajqu0hZwO3bnLbFe1KeUW7+O7fO62Wj4q4IgTF/rb+467DtI4wI6npF!p3XC1+gHWLgBMuyWhXB9mJ53LZLloDhAk4hjy7eBEZu80z8e4+cT/DSxmTSNCQv+AwXu+Lb/3bW3!zualIckG/w== 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: 2526 Xref: csiph.com comp.lang.c:21922 Robert Wessel wrote: > > On Wed, 06 Jun 2012 09:10:37 -0400, pete > wrote: > > >Robert Wessel wrote: > >> > >> On Wed, 06 Jun 2012 00:20:21 -0400, pete > >> wrote: > >> > >> >Noob wrote: > >> >> > >> >> pete wrote: > >> >> > >> >> > I've never needed the three way comparison > >> >> > to implement any sorting algorithm. > >> >> > > >> >> > It has always been sufficient for me > >> >> > to merely use a (Greater Than) macro, GT(A, B), > >> >> > to implement any sorting algorithm. > >> >> > > >> >> > #define GT(A, B) ((*A)->Data > (*B)->Data) > If you have the conditions for a merge sort, it's one of the best > choices, if not the best choice. It does require additional storage > beyond the records to be sorted itself. Obviously so does adding the > extra key segment need to force a sort to be stable. Whether or not > stability is important is one of the tradeoffs in selecting a sort (in > fact, it's actually a fairly rare requirement). Anyway, the point that I was was originally trying to make to Jacob Navia, still stands; Which is, that I have never needed anything else but a GreaterThan macro, to implement any kind of comparison sorting algorithm, stable or otherwise. -- pete