Skip to content

fix: correct recursive merge sort implementation - #1

Open
bterwijn wants to merge 2 commits into
suresh-srivastava:mainfrom
bterwijn:main
Open

fix: correct recursive merge sort implementation#1
bterwijn wants to merge 2 commits into
suresh-srivastava:mainfrom
bterwijn:main

Conversation

@bterwijn

Copy link
Copy Markdown

I found some bugs in: sorting-algorithms/merge_sort_recursive.py

Fix broken indentation in the merge step, create the temporary buffer only once, and handle empty lists correctly by using low >= up as the recursive base case.

For comparison:
old: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/suresh-srivastava/data-structures-and-algorithms-in-python/refs/heads/main/sorting-algorithms/merge_sort_recursive.py&timestep=0.2&play
new: https://memory-graph.com/#codeurl=https://raw.githubusercontent.com/bterwijn/data-structures-and-algorithms-in-python/refs/heads/main/sorting-algorithms/merge_sort_recursive.py&timestep=0.2&play

For more information, see the email I've send to your yahoo account.

bterwijn added 2 commits June 11, 2026 13:23
Fix broken indentation in the merge step, create the temporary
buffer only once, and handle empty lists correctly by using
low >= up as the recursive base case.
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