Python icon indicating copy to clipboard operation
Python copied to clipboard

style: Add type hints and doctest to sorts/exchange_sort.py

Open Born-as-Harsha opened this issue 2 months ago • 0 comments

This PR is a quality and consistency update for the Exchange Sort implementation (created 4 years ago, issue #4600). The entire function structure was updated to meet current repository standards.

Changes include:

  • Adding type hints to the function signature (: list, -> list).
  • Including a clear doctest example in the docstring.
  • Adding the required if __name__ == '__main__': execution block.

Checklist (MANDATORY FIX)

Please read and check all relevant boxes:

  • [x] The title of the PR specifies the algorithm/feature being updated or added.
  • [x] I have formatted the code to meet the repository's style guidelines.
  • [x] I have added type hints to the function signature.
  • [x] I have included a doctest within the function's docstring.
  • [x] I have ensured the if __name__ == '__main__': block calls doctest.testmod().
  • [x] This PR resolves an open issue (If applicable, link it here: #ISSUE_NUMBER).
  • [x] I have included a brief explanation of the algorithm (if adding a new one).

Born-as-Harsha avatar Oct 27 '25 03:10 Born-as-Harsha