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

Function is_sorted

sorts/bogo_sort.py:33–37  ·  view source on GitHub ↗
(collection: list)

Source from the content-addressed store, hash-verified

31 """
32
33 def is_sorted(collection: list) -> bool:
34 for i in range(len(collection) - 1):
35 if collection[i] > collection[i + 1]:
36 return False
37 return True
38
39 while not is_sorted(collection):
40 random.shuffle(collection)

Callers 1

bogo_sortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected