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