(Choose 1 answer)
Given below is an implmentation of insertion sort:
void insertSort(int[] a, int n)
{int i, j, x;for(i=1;i<n;i++)
{x=a[i];j=i;
// missing statements
}
There are some statements missing. Which of blocks below can be used to get the correct implementation of insertion sort?
A. while(j>=0 && x<a[j-1]) {a[j]=a[j-1]; j; };a[j]=x;
B. while(j>0 && x<a[j-1]) {a[j]=a[j-1]; j--; };a[j]=x;
C. while(j>0 && x<a[j]) {a[j]=a[j-1]; j--; };a[j]=x;
D. while(j>0 && x<a[j-1]) (a[j-1]=a[j]; j; };a[j]=x;
Exit 34