8000 Merge sort Update variable names by EkanshMangal · Pull Request #2032 · TheAlgorithms/Python · GitHub
[go: up one dir, main page]

Skip to content

Merge sort Update variable names #2032

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 5 commits into from
May 24, 2020
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
Update mergesort.py
  • Loading branch information
cclauss authored May 24, 2020
commit d1c3e55cb788b62953cf7b92618618fcd4714782
3 changes: 1 addition & 2 deletions divide_and_conquer/mergesort.py
8816
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ def merge(arr, left, mid, right):
return arr


def mergesort(arr, left=0, right=0):
def mergesort(arr, left, right):
"""
>>> mergesort([3, 2, 1], 0, 2)
[1, 2, 3]
>>> mergesort([3, 2, 1, 0, 1, 2, 3, 5, 4], 0, 8)
[0, 1, 1, 2, 2, 3, 3, 4, 5]
"""
right = right or (len(arr) - 1)
if left < right:
mid = (left + right) // 2
# print("ms1",a,b,m)
Expand Down
0