Advertisement
kaburen

Insertion

Jan 28th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.21 KB | None | 0 0
  1. insertionSort(tab[], n)
  2.  
  3. if(n == 0)
  4.     return ;
  5.  
  6.     for(i = 1; i < n; i++)
  7.         {
  8.             temp = tab[i];
  9.             j = i;
  10.             while(j > 0 && temp < tab[j-1])
  11.                 {
  12.                     tab[j] = tab[j-1];
  13.                     j--;
  14.                 }
  15.             tab[j] = temp;
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement