Insertion sort in decreasing order.

Solved. Due to protect my code from plagiarism.
Last edited on
1
2
3
4
5
6
7
8
9
10
  for (int i=0; i<n; i++)  //insertion sort, ar[n], sort in decreasing order
  { 
    int index =i;
    for (int j=i+1; j<n; j++) 
      { 
 	     if (ar[index]<ar[j])
 	       index =j;
      }      
	swap (ar[i], ar[index]); 	
  } 
Topic archived. No new replies allowed.