MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / sort

Method sort

Java/Leetcode/Leetcode268.java:24–39  ·  view source on GitHub ↗
(int[] arr)

Source from the content-addressed store, hash-verified

22
23
24 static void sort(int[] arr) {
25 int i = 0;
26 while (i < arr.length) {
27 int charIndex = arr[i];
28 if (arr[i] > arr.length-1) {
29 i++;
30 continue;
31 }
32
33 if (arr[i] != arr[charIndex]) {
34 swap(arr, i, charIndex);
35 } else {
36 i++;
37 }
38 }
39 }
40
41 static void swap(int[] arr, int a, int b){
42 int temp=arr[a];

Callers 1

missingMethod · 0.95

Calls 1

swapMethod · 0.95

Tested by

no test coverage detected