Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- public static void trie(int []tab,int size)
- {
- int i,j,temp;
- for(i=0;i<size;i++)
- {
- for(j=0;j<size-1;j++)
- {
- if(tab[j]>tab[j+1])
- {
- temp=tab[j];
- tab[j]=tab[j+1];
- tab[j+1]=temp;
- }
- }
- }
- }
- public static void main(String[] args){
- int[] numbers= new int[100];
- int position=0;
- while(position<100){
- numbers[position]=(int)(10000*Math.random());
- System.out.print(numbers[position]+" ");
- position=position+1;
- }
- System.out.println();
- trie(numbers,numbers.length);
- for(int i=0;i<numbers.length;i++)
- {
- System.out.print(numbers[i] + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement