I am not sure what this line exactly means. Could anyone kindly explain what "comma" in (a, n) does exactly, please ? Also what is the difference between (a, n) and (a, minPos, n)?
* Sorts an array by the "selection sort" method.
* Find the position of the smallest element in the array,
* swap it with the next unsorted element
*
* @param a the array to sort
*/
public static void sort(int[] a)
{
for (int n = 0; n < a.length - 1; n++)
{
int minPos = minimumPosition(a, n);
if (minPos != n)
{
swap(a, minPos, n);
}
}
public static int minimumPosition(int[] a, int from)
{
int minPos = from;
for (int i = from + 1; i < a.length; i++)
{
if (a[i] < a[minPos])
{
minPos = i;
}
}
return minPos;
}
}