Sort
Sort
/**
* Write a description of class Sort here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Sort
{
//This function sorts an array
int[] bubbleSort (int[] nos)// Works by checking the first two elements sorting them ,
then moving on to the next two.
{
int f , s;
n = k + 1;
while(n < a.length)
{
s = a[k];
s2 = a[n];
if (s.compareToIgnoreCase(s2) > 0)
{
a[k] = s2;
a[n] = s;
}
n++;//only n should increase as the first element will become the shortest
}
k++;
}
return a;
}
}