From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10f6aa,e1e578817780dac2 X-Google-Attributes: gid10f6aa,public X-Google-Thread: 109fba,baaf5f793d03d420 X-Google-Attributes: gid109fba,public X-Google-Thread: fc89c,97188312486d4578 X-Google-Attributes: gidfc89c,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,97188312486d4578 X-Google-Attributes: gid103376,public From: Lawrence Kirby Subject: Re: Should I learn C or Pascal? Date: 1996/08/17 Message-ID: <840279292snz@genesis.demon.co.uk>#1/1 X-Deja-AN: 174734560 x-nntp-posting-host: genesis.demon.co.uk references: <4u7hi6$s2b@nntp.seflin.lib.fl.us> <4uo74j$95p@ns.broadvision.com> <4uu9v3$hrp@goanna.cs.rmit.edu.au> x-mail2news-path: genesis.demon.co.uk organization: none reply-to: fred@genesis.demon.co.uk newsgroups: comp.lang.c,comp.lang.c++,comp.unix.programmer,comp.lang.ada,comp.os.msdos.programmer Date: 1996-08-17T00:00:00+00:00 List-Id: In article <4uu9v3$hrp@goanna.cs.rmit.edu.au> ok@goanna.cs.rmit.edu.au "Richard A. O'Keefe" writes: >Quicksort still has a niche in embedded processors, >although there is a new version of heapsort (also published in the >Computer Journal, but I can't find the reference) which can challenge it: My experience of heapsort is that while it can beat quicksort in number of comparisons it requires more data movement and has more algorithmic overhead which makes it slower. >the modern heapsort has the virtue that its worst case is O(nlgn) which >makes it a better bet for soft-real-time work. Heapsort has always been O(n log n). You're right that a guaranteed reasonable worst case is sometimes useful. >For general use, a well engineered merge sort is as good as a well engineered >quicksort; sometimes better. It is close but very rare indeed for a heapsort to run faster than a quicksort. >For sorting machine integers, a well engineered radix sort (or even count >sort if the range is small enough) is so much faster that it isn't funny. > >For most programmers, the main issue is that it is cheaper to re-use >an existing expertly implemented and thoroughly tested sort procedure >than to write their own buggy code. As far as the C language is concerned merge sort and radix sort aren't good choices for qsort(). -- ----------------------------------------- Lawrence Kirby | fred@genesis.demon.co.uk Wilts, England | 70734.126@compuserve.com -----------------------------------------