import java.util.Arrays;
public class Cvicenie {
public static boolean jeUsporiadane(int[] p) {
return false;
}
public static int binarneHladajIndex(int[] p, int hodnota) {
int odIdx = 0;
int poIdx = p.length-1;
while (odIdx <= poIdx) {
int stredIdx = (odIdx + poIdx) / 2;
if (p[stredIdx] == hodnota) {
return stredIdx;
}
if (hodnota < p[stredIdx]) {
// Vlavo
poIdx = stredIdx - 1;
} else {
// Vpravo
odIdx = stredIdx + 1;
}
}
return -1;
}
public static void main(String[] args) {
int[] p = {4, 7, 1, 4, 8, 2};
TriediaciAlgoritmus triedic = new BubbleSort();
System.out.println(Arrays.toString(p));
triedic.utried(p);
System.out.println(Arrays.toString(p));
}
}