Advertisement
Danielos168

InsertSort Descending

Nov 20th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.23 KB | None | 0 0
  1. static void Wstawianie( int[] tab )
  2. {
  3.     for( int i = 1; i < tab.Length; i++ )
  4.     {
  5.         int key = tab[ i ];
  6.         int j = i;
  7.         while( j > 0 && tab[ j - 1 ] < key )
  8.         {
  9.             tab[ j ] = tab[ j - 1 ];
  10.             j--;
  11.         }
  12.         tab[ j ] = key;
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement