MCPcopy Create free account
hub / github.com/SR-Sunny-Raj/Hacktoberfest2021-DSA / compAndSwap

Method compAndSwap

06. Sorting/BitonicSort.java:7–17  ·  view source on GitHub ↗
(int a[], int i, int j, int dir)

Source from the content-addressed store, hash-verified

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 {

Callers 1

bitonicMergeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected