Q3 B

 avatar
Sameh
c_cpp
a year ago
282 B
4
Indexable
void insertionSort(int *a , int n)
{
    int temp , j;
    for (int i = 1 ; i < n ; i++)
    {
        temp = a[i];
        j = i - 1;
        while(j >= 0 && a[j] > a[i])
        {
            a[j + 1] = a[j];
            j--;
        }
        a[j+1] = temp;
    }
}
Editor is loading...
Leave a Comment