Article View: rec.games.programmer
Article #1036Re: Advice needed for fastest sort algorthm
From: Edward Lee
Date: Mon, 09 Nov 1992 09:49
Date: Mon, 09 Nov 1992 09:49
28 lines
1801 bytes
1801 bytes
A radix sort has a time complexity of O(N), which means that it operates in linear time on N units of data. It is asymptotically faster than a Quick Sort which operates in O(N*log(N)) time. This means that the more data you sort, the faster a radix sort will be over a Quick Sort, as long as you have enough memory to continue the radix sorting. The time difference between the Quick Sort and a radix sort is the log(N) factor times some other constant factor. How does this relate to your problem? If you have several or many objects such as bitmaps or windows that you are displaying on a screen, you can represent their distance from the front of the screen or the observer as an integer. 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. The existence of a path in the binary radix tree indicates the existence of a particular integer. Recursively descending the binary tree and recording the path as you go along will produce ordered list of integers in either ascending or descending order depending on the direction in which the descent begins. I have written some radix sorting code but am not ready to release it. Perhaps you can write some of your own code based on what I have written above. -Ed L
Technical Details
Message-ID:
<BxG0MC.7yK@chinet.chi.il.us>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!uchinews!machine!chinet!edleeReferences:
<6759@news.duke.edu> <BxD5pt.DyI@news.cso.uiuc.edu>Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!uchinews!machine!chinet!edlee From: edlee@chinet.chi.il.us (Edward Lee) Subject: Re: Advice needed for fastest sort algorthm Message-ID: <BxG0MC.7yK@chinet.chi.il.us> Organization: Chinet - Public Access UNIX References: <6759@news.duke.edu> <BxD5pt.DyI@news.cso.uiuc.edu> Date: Mon, 9 Nov 1992 09:49:23 GMT Lines: 28