Conversation
There was a problem hiding this comment.
Pull request overview
Adds a standalone Python merge sort implementation and expands the repository README with an additional “Poem for Coders” section.
Changes:
- Added
merge_sort.pycontainingmerge_sort()andmerge()plus a__main__demo block. - Updated
README.mdwith an extra poem section.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| merge_sort.py | Introduces merge sort implementation and demo/test prints. |
| README.md | Adds a poem section to the project README. |
| """ | ||
| Merge Sort Algorithm Implementation | ||
|
|
||
| MEMORY: This file contains a simple merge sort implementation in Python. |
There was a problem hiding this comment.
The module docstring includes an internal-sounding "MEMORY:" marker. This reads like an instruction/annotation rather than user-facing documentation; please remove it or rephrase it as normal descriptive text so it doesn’t leak internal metadata into the codebase.
| MEMORY: This file contains a simple merge sort implementation in Python. | |
| This file contains a simple merge sort implementation in Python. |
| """ | ||
| # Base case: arrays with 1 or 0 elements are already sorted | ||
| if len(arr) <= 1: | ||
| return arr |
There was a problem hiding this comment.
The docstring states this returns "A new sorted array", but in the base case (len <= 1) it returns the original list object unchanged. Either return a shallow copy in the base case (to keep the contract consistent) or adjust the docstring to clarify that the input may be returned as-is for small inputs.
| return arr | |
| return arr.copy() |
This is the second pull request review