comp.lang.ada
 help / color / mirror / Atom feed
From: mfb@mbunix.mitre.org (Michael F Brenner)
Subject: Re: Anyone help develop an algorythm?
Date: 1997/04/25
Date: 1997-04-25T00:00:00+00:00	[thread overview]
Message-ID: <5jqds4$mfa@top.mitre.org> (raw)
In-Reply-To: 97042417025012@psavax.pwfl.com


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

one could enhance it as follows 

     -- precondition: the unsorted array of integers has no repeats and
     --               is already read into the array object_list

     subtype sub_type is object_exact_integer_type range
        get_min (all_objects) .. get_max (all_objects);

     type ar_ray is array (object_exact_integer_type range <>);
     subtype condensed_essence_of_objects is ar_ray range sub_type;

     for i in indexes loop
       ar_ray (object_list (i)) := True;
     end loop;

     for i in sub_type loop
       j := get_next_non_zero_index;
       text_io.put_line (my_image (j));
     end loop;

     -- 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.




  reply	other threads:[~1997-04-25  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-24  0:00 Anyone help develop an algorythm? Marin David Condic, 561.796.8997, M/S 731-93
1997-04-25  0:00 ` Michael F Brenner [this message]
1997-04-28  0:00   ` Matthew Givens
1997-04-28  0:00 ` Matthew Givens
  -- strict thread matches above, loose matches on Subject: below --
1997-04-20  0:00 Matthew Givens
1997-04-20  0:00 ` Joel VanLaven
1997-04-22  0:00   ` Robert Dewar
1997-04-20  0:00 ` Robert Dewar
1997-04-23  0:00   ` Matthew Givens
1997-04-23  0:00     ` Robert Dewar
1997-04-20  0:00 ` Robert A Duff
1997-04-22  0:00   ` Steve Doiel
1997-04-20  0:00 ` Tom Moran
1997-04-22  0:00   ` Michael F Brenner
1997-04-20  0:00 ` Tucker Taft
     [not found] ` <e8yijs.fg1.0.-s@inmet.camb.inmet.com>
1997-04-23  0:00   ` Matthew Givens
1997-04-23  0:00     ` Tucker Taft
1997-04-23  0:00     ` Robert Dewar
1997-04-28  0:00       ` Matthew Givens
     [not found] ` <335af137.54d7@bix.com>
1997-04-28  0:00   ` Matthew Givens
1997-04-28  0:00     ` Robert Dewar
1997-04-29  0:00       ` Matthew Givens
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox