The purpose of a sorting algorithm is to order/categorize set of items within a series of items.
Write a program/method to swap two neighboring numbers in an array when the first index is given.
void swapTwoNumbers(int numbers[],int firstIndex)
{
int temp = numbers[firstIndex];
numbers[firstIndex] = numbers[firstIndex+1];
numbers[firstIndex+1] = temp;
}
Comments
Leave a comment