Skip to content

Commit f0d910b

Browse files
authored
Update bogo_sort.py
The if statement I deleted is actually redundant: if len(collection) is smaller than 2 then the for loop will not execute (range() function starts from 0 by default) and the function will return True.
1 parent 126e89d commit f0d910b

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

sorts/bogo_sort.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ def bogo_sort(collection):
3131
"""
3232

3333
def is_sorted(collection):
34-
if len(collection) < 2:
35-
return True
3634
for i in range(len(collection) - 1):
3735
if collection[i] > collection[i + 1]:
3836
return False

0 commit comments

Comments
 (0)