Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void calcKendall(Comparable[] a, Comparable[] b) {
- Comparable[] fixed = new Comparable[a.length];
- for(int i = 0; i < a.length; i++) {
- for(int j = 0; j < a.length; j++) {
- if(b[i] == a[j]) {
- fixed[i] = j;
- break;
- }
- }
- System.out.println(fixed[i]);
- }
- inversions = 0;
- Comparable[] aux = new Comparable[a.length];
- sort(fixed, aux, 0, a.length-1);
- System.out.println("total inversions: " + inversions);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement