Re: User Defined type()



Swap indices when sorting, not element values. It's much quicker. In other
words, keep a separate array of indices and swap them around as you sort
your source array

Tony Proctor

"Lex Harrelson" <lexharr@xxxxxxxxx> wrote in message
news:dq1kpo$2h2h$1@xxxxxxxxxxxxxxxxxxxx
> I have user defined type dim 1000 deep....This data is collected from a
> comma delimited file....I want to sort the array with a method that
requires
> the swapping of the compared type....tryng this in vb.net I get a casting
> error when I execute the swap of :
> array(0)=array(10)
> array(10)=array(100)
> array(100)=array(0)
> The user defined type as 7 elements that are a mixtue of string and
nemeric
> Thanks in advance for any help offered
>
> Lex
>
>


.



Relevant Pages

  • Re: problem in solving this.
    ... element is selected and placed at the end of the array. ... It looks like bubble sort to me. ... One swap per pass. ...
    (comp.lang.fortran)
  • Re: quick sort
    ... The following is the quick sort function which i have seen in my note ... choice of which elements to swap. ... toward the beginning of the array. ... using a bubblesort, which has fewer overheads. ...
    (comp.lang.c)
  • Re: qsort and arbitrary types
    ... > routines), the actual data is not swapped around at all. ... > the data array which express the proper ordering. ... The C qsort() function will sort whatever array is passed ... > a permutation of the indices, you only need a conditional SWAP ...
    (comp.lang.fortran)
  • Re: Sorting
    ... The easiest, probably, is to go through the array. ... Compare the number you are on with the number above it. ... Set a flag when you swap, and clear it each time you restart. ... Vastly inferior to the selection sort already ...
    (comp.lang.c)
  • Re: "Sorting" assignment
    ... And many others prefer to call partition exchange because "quicksort" ... bin B depending on whether it is greater than, ... If the array is already sorted, this means that you end up ... attempt to sort them. ...
    (comp.programming)