MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / stooge_sort

Function stooge_sort

sorts/stooge_sort.py:1–11  ·  view source on GitHub ↗

Examples: >>> stooge_sort([18.1, 0, -7.1, -1, 2, 2]) [-7.1, -1, 0, 2, 2, 18.1] >>> stooge_sort([]) []

(arr: list[int])

Source from the content-addressed store, hash-verified

1def stooge_sort(arr: list[int]) -> list[int]:
2 """
3 Examples:
4 >>> stooge_sort([18.1, 0, -7.1, -1, 2, 2])
5 [-7.1, -1, 0, 2, 2, 18.1]
6
7 >>> stooge_sort([])
8 []
9 """
10 stooge(arr, 0, len(arr) - 1)
11 return arr
12
13
14def stooge(arr: list[int], i: int, h: int) -> None:

Callers 1

stooge_sort.pyFile · 0.85

Calls 1

stoogeFunction · 0.85

Tested by

no test coverage detected