Python icon indicating copy to clipboard operation
Python copied to clipboard

docs: add time and space complexity to selection_sort docstring

Open kl2400033266 opened this issue 1 month ago • 1 comments

Added Time Complexity O(n^2) and Space Complexity O(1) documentation to the selection_sort function docstring, improving code documentation for beginners as requested in issue #13948.

Describe your change:

This PR adds time and space complexity information to the selection_sort function docstring in sorts/selection_sort.py. The documentation now includes:

  • Time Complexity: O(n^2) - with explanation of the nested loops
  • Space Complexity: O(1) - noting that only constant extra space is used
  • [ ] Add an algorithm?
  • [ ] Fix a bug or typo in an existing algorithm?
  • [ ] Add or change doctests?
  • [x] Documentation change?

Checklist:

  • [x] I have read CONTRIBUTING.md.
  • [x] This pull request is all my own work -- I have not plagiarized.
  • [x] I know that pull requests will not be merged if they fail the automated tests.
  • [x] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.

Related to issue #13948

kl2400033266 avatar Nov 27 '25 04:11 kl2400033266

Hi @vishalbeniwal @mCoding 👋 Just checking in to see if this PR is ready for review. All checks have passed, and the documentation updates for selection_sort are complete. Whenever you have a moment, I would appreciate an approval so it can be merged. Thank you!

kl2400033266 avatar Nov 27 '25 04:11 kl2400033266