Skip to content

Fix merge sort remaining elements merge logic#34

Open
Yashasvi-dot-V wants to merge 1 commit intosubbarayudu-j:masterfrom
Yashasvi-dot-V:newbranch
Open

Fix merge sort remaining elements merge logic#34
Yashasvi-dot-V wants to merge 1 commit intosubbarayudu-j:masterfrom
Yashasvi-dot-V:newbranch

Conversation

@Yashasvi-dot-V
Copy link

Description

This pull request updates the merge_sort implementation in sorts/merge_sort.py.

Changes Made

  • Replaced the while loops used to copy the remaining elements from the left and right halves with Python slicing assignment (collection[k:] = ...).
  • This simplifies the code while maintaining the same functionality and correctness of the merge step.

Testing

  • Ran the existing doctests using python -m doctest -v sorts/merge_sort.py.
  • All tests passed successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant