Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void selection(Dete[] niz) {
- for(int i = 0; i < niz.length - 1; i++) {
- Dete min = niz[i];
- int idxmin = i;
- for (int j = i+1; j < niz.length; j++) {
- if (niz[j].compareTo(min) < 0) {
- min = niz[j];
- idxmin = j;
- }
- }
- swap(niz, i, idxmin);
- }
- }
- private static void swap(Dete[] niz, int a, int b) {
- Dete temp = niz[a];
- niz[a] = niz[b];
- niz[b] = temp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement