(int a[], int i, int j, int dir)
| 5 | with the direction, then a[i] and a[j] are |
| 6 | interchanged. */ |
| 7 | void compAndSwap(int a[], int i, int j, int dir) |
| 8 | { |
| 9 | if ( (a[i] > a[j] && dir == 1) || |
| 10 | (a[i] < a[j] && dir == 0)) |
| 11 | { |
| 12 | // Swapping elements |
| 13 | int temp = a[i]; |
| 14 | a[i] = a[j]; |
| 15 | a[j] = temp; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | void bitonicMerge(int a[], int low, int cnt, int dir) |
| 20 | { |