[GAP Forum] Ascending selection sort algorithm ERROR

sam johnson liveat1892 at gmail.com
Fri Nov 15 00:15:27 GMT 2013


Hey guys... I'm trying to write the code for and ascending order selection
sort algorithm and every time I try to read the function that I
implemented, GAP would just stop working no error messages no nothing so
it's difficult to determine the source of error. I need somone to tell me
whre did I go wrong with my code.

code:

*sortAscending := function(L)*
*     local x, i, max, hold;*
*     i := Size(L)-1;*

*     while i > 0 do*
*         max := L[i];*
*         x := i ;   *
*         while x > 0 do*
*             if L[x] > max  then*
*                  max := L[x];*
*             fi;*
*         od;*
*         hold := max;*
*         max := L[i];*
*         L[i] := hold;*
*         i := i -1;*
*    od;*
*    return L;*
*end; *


More information about the Forum mailing list