Skip to content

Adding stooge sort #1206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated doctest
  • Loading branch information
Charitoc authored Sep 26, 2019
commit 798a2460dca6108c707a3aa48711d0a0744d29ba
17 changes: 7 additions & 10 deletions sorts/stooge_sort.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
def stoogesort(arr):
"""
>>> arr = [2, 4, 5, 3, 1]
>>> stoogesort(arr)
>>> print(arr)
[1, 2, 3, 4, 5]
"""
stooge(arr,0,len(arr)-1)


def stooge(arr, i, h):

"""

>>> arr = [2, 4, 5, 3, 1]
>>> stoogesort(arr)
>>> print(arr)
[1, 2, 3, 4, 5]

"""



if i >= h:
return

Expand Down