I converted it to GScript so that it can be tested by Graal developers.
PHP Code:
dataSet = {1, 6, 4, 2, 5, 8, 20, 100, 54, 1000, 523};
echo(dataSet);
selectionSort();
echo(dataSet);
function selectionSort()
{
for (a = 0; a < dataSet.size() - 1; a++)
{
for (b = a + 1; b < dataSet.size(); b++)
{
if (dataSet[b] < dataSet[a])
{
result = dataSet[b];
dataSet[b] = dataSet[a];
dataSet[a] = result;
}
}
}
}
Very nice, Gambet.
Quote:
Originally Posted by xXziroXx
I thought we were not allowed to post non-GScript scripts in the Code Library. 
|
I did the same thing about 2 years ago when I posted the Java code for an analog clock. Skyld let it stay for the reason that the formula might help some people, and this is a similar case.