Article View: rec.games.programmer
Article #1150Re: Advice needed for fastest sort algorthm
From: Dan King
Date: Wed, 11 Nov 1992 16:39
Date: Wed, 11 Nov 1992 16:39
58 lines
2980 bytes
2980 bytes
In a previous article, warwick@cs.uq.oz.au (Warwick Allison) writes: |> |> >A radix sort has a time complexity of O(N), which means that it |> >operates in linear time on N units of data. |> |> Gee, I'm sure the theoreticians would LOVE to see the algorithm, |> since it has been PROVED long ago that sorting takes O(N log N) |> time OPTIMALLY. Quoting from The Art of Computer Programming, Volume 3 (pp176-178): "[r]adix sorting is usually more efficient than any other known sorting method for internal sorting." Speaking about his example program, Knuth says, "A p-pass version of the program would take (11p-1)N+O(pM) units of time." [p is the number of keys and M is the number of radix piles] Finally, in the theoretical analysis of the algorithm (p178), Knuth finds that, if p=2 and M > sqrt(N), the average sorting time is O(N) instead of order NlogN. |> >This integer may then be |> >represented as the path in a binary tree, with the higher order |> >bits represented as paths near the root and the lower order bits as |> >paths near the leaves. |> |> Guess what? The number of bits will be of the order LOG N !!!!!! Better check your references. |> Let's rename this group to rec.games.!programmer, and succumb to the |> community's belief that "games programmers" aren't real programmers |> at all. All the Windows programmers and DOS device driver programmers |> can then cross there arms smugly and shake their heads at us non- |> programmers, who can only write GAMES, saying "gee, they've discovered |> SORTING"... Better yet, how about renaming it to "alt.games.programmer.cant.read"? DOS programmers are "real" programmers? (snicker) (I'm only kidding, guys!) |> Come on people, games programming is definately an art-form, but we |> really must learn to hold our mallet and chisel correctly. (Of course, |> asm programmers only need to learn to hold the chisel, since they use |> their head to supply the force). Yep, games are an art form. So is the process of not reinventing the wheel. It involves a bit of research. Maybe you should spend a little more time at the local library? :) Assembly programmers don't use mallets. They use toothpicks and simply hit them 90,000 times in the same time a mallet could strike once. This works really well until they discover that they're striking the wrong piece of rock... |> Warwick dank
Technical Details
Message-ID:
<1drd06INNnji@calvin.usc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!destroyer!sol.ctr.columbia.edu!usc!dankReferences:
<6759@news.duke.edu> <BxD5pt.DyI@news.cso.uiuc.edu> <BxG0MC.7yK@chinet.chi.il.us> <10991@uqcspe.cs.uq.oz.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!sol.ctr.columbia.edu!usc!dank From: dank@calvin.usc.edu (Dan King) Newsgroups: rec.games.programmer Subject: Re: Advice needed for fastest sort algorthm Date: 11 Nov 1992 08:39:34 -0800 Organization: University of Southern California, Los Angeles, CA Lines: 58 Distribution: world Message-ID: <1drd06INNnji@calvin.usc.edu> References: <6759@news.duke.edu> <BxD5pt.DyI@news.cso.uiuc.edu> <BxG0MC.7yK@chinet.chi.il.us> <10991@uqcspe.cs.uq.oz.au> Reply-To: dank@usc.edu NNTP-Posting-Host: calvin.usc.edu