Unofficial Content

Bubble ascending sort

&myArray() as Numeric unsorted
&iCount as Numeric is the Upper Bound of the array


&Tmp as Numeric same myArray (but not is an array)
&i as Numeric same &iCount
&j as Numeric same &iCount

for &i = &iCount - 1 to 1 step -1
   for &j = 1 to &i
      if &myArray(j) >  &myArray(j 1)
         &Tmp = &myArray(j)
         &myArray(j) = &myArray(j 1)
         &myArray(j 1) = &Tmp
      endif
   endfor
endfor


Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant