MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / swap

Method swap

Programs/WiggleSorting.java:7–11  ·  view source on GitHub ↗
(int[] arr, int a, int b)

Source from the content-addressed store, hash-verified

5
6 // A utility method to swap two numbers.
7 void swap(int[] arr, int a, int b) {
8 int temp = arr[a];
9 arr[a] = arr[b];
10 arr[b] = temp;
11 }
12
13 // This function sorts arr[0..n-1] in wave form, i.e.,
14 // arr[0] >= arr[1] <= arr[2] >= arr[3] <= arr[4]....

Callers 1

sortInWaveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected