import java.util.Arrays;
public class Spustac {
/**
* @param args
*/
public static int hodnotaVStrome(int[] pole, String cesta){
int index=0;
for(int i=0;i<cesta.length();i++){
if (cesta.charAt(i)=='L'){
index=2*index+1;
}else
index=2*index+2;
}
return pole[index];
}
public static boolean jeHaldou(int[] pole){
for(int i=pole.length-1;i>0;i--){
if (pole[(i-1)/2]>pole[i])
return false;
}
return true;
}
public static int[] zluc(int[] p1, int[] p2){
int index1=0,index2=0;
int[] vysledok=new int[p1.length+p2.length];
while(index1<p1.length && index2<p2.length){
if (p1[index1]<p2[index2]){
vysledok[index1+index2]=p1[index1];
index1++;
}else{
vysledok[index1+index2]=p2[index2];
index2++;
}
}
if (index1==p1.length){
while(index2<p2.length){
vysledok[index1+index2]=p2[index2];
index2++;
}
}else{
while(index1<p1.length){
vysledok[index1+index2]=p1[index1];
index1++;
}
}
return vysledok;
}
public static void main(String[] args) {
TriediaciAlgoritmus ta=new QuickSort();
int p[]= new int[10];
//int[] p={10,40,15,75,60,65,80,50};// new int[10];
//int[] p={100,400,150,7,6,5,8,500};// new int[10];
for(int i=0;i<8;i++)
p[i]=(int) (Math.random()*100);
System.out.println(Arrays.toString(p));
/*ta.utried(p);
System.out.println("Porovnani: "+ta.getPocetPorovnani());
System.out.println("Vymen: "+ta.getPocetVymen());
System.out.println(Arrays.toString(p));
*/
//int[] p={1,2,3,4,5,6,7,8,9};
int[] p1={1,3,5,7,9};
int[] p2={1,2,3,4,5};
System.out.println(Arrays.toString(zluc(p1,p2)));
//System.out.println(jeHaldou(p));
//System.out.println(hodnotaVStrome(p, "LPLPLPLP"));
}
}