Sunday 12 June 2016

Insertion Sort Algorithm in C++

for (int i = 0; i < size; i++)
{
int j = i;
while (arr[j - 1]>arr[j])
{
int temp = arr[j - 1];
arr[j - 1] = arr[j];
arr[j] = temp;
j--;
}
}

No comments:

Post a Comment