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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,50880f040eb869b4 X-Google-Attributes: gid103376,public From: NKSW39B@prodigy.com (Matthew Givens) Subject: Re: Anyone help develop an algorythm? Date: 1997/04/28 Message-ID: <5k14hk$37vc@newssvr01-int.news.prodigy.com>#1/1 X-Deja-AN: 237832037 Distribution: world References: <97042417025012@psavax.pwfl.com> <5jqds4$mfa@top.mitre.org> Organization: Prodigy Services Company 1-800-PRODIGY Newsgroups: comp.lang.ada Date: 1997-04-28T00:00:00+00:00 List-Id: mfb@mbunix.mitre.org (Michael F Brenner) wrote: > > >Slow sort is an interesting development, but might not satisfy the realtime >criterion for certain non-genetic embedded systems. Taking the basic loop > > loop > find two elements which are out of order > swap them > end loop -- SNIP -- > -- This sort takes time linear in the number of elements of your > -- array on any machine in which inputting, outputting, searching > -- for the next non-zero index, imaging, indexing arrays, and > -- reading and writing bits in bit arrays can be done in constant > -- time; the main exception to this will be searching for the next > -- non-zero index. The BESM-6 computer produced by Russia has a > -- hardware op-code to do this, however, it is only useful for > -- sorting arrays whose object values range from 0..7 with no repeats. Hmmmm, not too many years ago I made my own contribution to the world of sorting algorythms with RandomSort. It was simple, really. Take the array elements, and assign them randomly to a second array. Then scan the second array to see if it's sorted. If not, scrap everything and do it again. It's worse than the Slow Sort, because there's a chance (depending on the Psuedo-Random number generator being used and the seed value fed to it) that the list will NEVER be sorted. It has happened to me (I think that almost 24 hours for a 25 element array kind of points to never, don't you?). - If at first you don't succeed, destroy all evidence that you ever tried. << Iceman >>