Advertisement
niske

Insertion

Nov 13th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. public static void insertion(Dete[] niz) {
  2. for (int i = 1; i < niz.length; i++) {
  3. Dete temp = niz[i];
  4. int j = i-1;
  5.  
  6. while(j >= 0 && niz[j].compareTo(temp) > 0) {
  7. niz[j+1] = niz[j];
  8. j--;
  9. }
  10. niz[j+1] = temp;
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement