I have the following function to sort an unordered array to having even numbers in the front and odd numbers in the back. Is there a way to get it done without using any loops?
//front is 0, back =array.length-1;
arrangeArray (front, back);
public static void arrangeArray (int front, int back)
{
if (front != back || front<back)
{
while (numbers [front]%2 == 0)
front++;
while (numbers[back]%2!=0)
back--;
if (front < back)
{
int oddnum = numbers [front];
numbers[front]= numbers[back];
numbers[back]=oddnum;
arrangeArray (front+1, back-1);
}
}
}