C&S 2024 Exam - Question 3 (b)
itsLu
c_cpp
2 years ago
336 B
6
Indexable
#include <iostream>
using namespace std;
void Insertion_Sort (int arr[], int n)
{
int key, k, m;
for (k = 0 ; k < n ; k++)
{
key = arr[k];
m = k - 1;
while (m >= 0 && arr[m] > key)
{
arr[m + 1] = arr[m];
m--;
}
arr[m+1] = key;
}
}Editor is loading...
Leave a Comment