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

Method swap

src/main/java/com/thealgorithms/others/BFPRT.java:173–177  ·  view source on GitHub ↗

Swaps two elements in an array. @param arr the input array @param i the index of the first element @param j the index of the second element

(int[] arr, int i, int j)

Source from the content-addressed store, hash-verified

171 * @param j the index of the second element
172 */
173 public static void swap(int[] arr, int i, int j) {
174 int temp = arr[i];
175 arr[i] = arr[j];
176 arr[j] = temp;
177 }
178}

Callers 3

partitionMethod · 0.95
insertionSortMethod · 0.95
permuteMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected