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

Method sort

src/main/java/com/thealgorithms/sorts/BeadSort.java:15–18  ·  view source on GitHub ↗

Sorts the given array using the BeadSort algorithm. @param array The array of non-negative integers to be sorted. @return The sorted array. @throws IllegalArgumentException If the array contains negative numbers.

(int[] array)

Source from the content-addressed store, hash-verified

13 * @throws IllegalArgumentException If the array contains negative numbers.
14 */
15 public int[] sort(int[] array) {
16 allInputsMustBeNonNegative(array);
17 return extractSortedFromGrid(fillGrid(array));
18 }
19
20 private void allInputsMustBeNonNegative(final int[] array) {
21 if (Arrays.stream(array).anyMatch(s -> s < 0)) {

Callers 1

testBeadSortMethod · 0.95

Calls 3

extractSortedFromGridMethod · 0.95
fillGridMethod · 0.95

Tested by 1

testBeadSortMethod · 0.76