- We are using bubble sort algorithm for the Sorting of ARRAY.
static int[] ArraySort(int[] input)
{
int count = input.Length;
int temp = 0;
do
{
int newcount = 0;
for (var i = 1; i < count; i++)
{
if (input[i] < input[i - 1])
{
temp = input[i];
input[i] = input[i-1];
input[i-1] = temp;
newcount = i;
}
}
count = newcount;
} while (count > 0);
return input;
}