Create a function/program to sort 10 data struct mhs saved in array of structure, using insertion sort. Sort is based on gpa (ascending), for similar gpa then sort by name (ascending). struct mhs{ int...


Create a function/program to sort 10 data struct mhs saved in array of structure, using insertion sort.

Sort is based on gpa (ascending), for similar gpa then sort by name (ascending).


struct mhs{

int nim;

float gpa;

char name[20];

};




insertion sort


void Insertion(int *A, int n){


   int i, j, key;


   for(i=n; i; i++) {


       key = A[i];


       j = i-1;


       while (j>=0 && key


          A[j+1] = A[j];


          j--;


       }


       A[j+1] = key;


   }


}



Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here