Re: Optimizing An Integer Array Reverse

From: toby (spamtrap_at_crayne.org)
Date: 03/03/05


Date: Thu, 3 Mar 2005 07:34:15 +0000 (UTC)

spamtrap@crayne.org wrote:
> In my Computer Organization class, we wrote an algorithm in lab to
> reverse arrays of ints.

So does it sort the array, reverse the array, or sort in reverse order?
I can't figure out from your English description and I'm not going to
decode that listing to find out. If the former, which algorithm does it
use? ISTR sorting has been studied before, in fact Prof. Knuth wrote a
book about it, which can be purchased here:

http://dogbert.abebooks.com/servlet/SearchResults?an=knuth&tn=sorting



Relevant Pages

  • Re: Okay to move an "object" will-nilly?
    ... I wrote a funky kind of algorithm for sorting an array (whether ... the objects in the array must be move safe. ... the array was already sorted so no swaps were performed by the sort. ...
    (comp.lang.c)
  • Re: Fastcode poll - Should Sort include worst case situations
    ... median algorithm, not O), there exists sequences that will beat ... quicksort and make it O. ... by many compiler vendors is "Engineering a Sort ... If it detects that a portion of an array is responding badly, ...
    (borland.public.delphi.language.basm)
  • Re: Hash table in C++? STL?
    ... The Oalgorithm is when you scan all ... > Assume array a and b both have N elements, ... > Will a binary search beat a hash lookup? ... Running time O) for the sort if using ...
    (comp.lang.cpp)
  • Re: Sorting
    ... The easiest, probably, is to go through the array. ... This algorithm is called bubblesort. ... less efficient than selection sort or insertion sort, ... What memory management is below? ...
    (comp.lang.c)
  • Re: Sorting
    ... Then go back to the start of the array and do it again, until you make a clean sweep without swapping. ... This algorithm is called bubblesort. ... less efficient than selection sort or insertion sort, ...
    (comp.lang.c)