kaburen

Select

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