Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public static void bubblesort2d(int a[][]){
  2. int temp;
  3. for(int i=0;i<a.length;i++){
  4. for(int j=0;j<a.length-1-i;j++){
  5. if(a[j][1]<a[j+1][1]){
  6. temp=a[j][0];a[j][0]=a[j+1][0];a[j+1][0]=temp;
  7. temp=a[j][1];a[j][1]=a[j+1][1];a[j+1][1]=temp;
  8. }
  9. else if(a[j][1]==a[j+1][1]){
  10. if(a[j][0]<a[j+1][0]){
  11. temp=a[j][0];a[j][0]=a[j+1][0];a[j+1][0]=temp;
  12. temp=a[j][1];a[j][1]=a[j+1][1];a[j+1][1]=temp;
  13. }
  14. }
  15. }
  16. }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement