Skip to content

sorts: make bogo_sort generic for comparable items - #15401

Merged
cclauss merged 3 commits into
TheAlgorithms:masterfrom
peeyushtiwary27:bogo-sort-comparable
Sep 22, 2026
Merged

cclauss merged 3 commits into
TheAlgorithms:masterfrom
peeyushtiwary27:bogo-sort-comparable

Conversation

@peeyushtiwary27

Copy link
Copy Markdown
Contributor

Describe your change

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests?
  • Documentation change?

This PR makes bogo_sort generic for comparable items using the Comparable protocol.

It adds comparable string and float examples, plus a TypeError test for incomparable items.

All existing sort tests pass.

Part of #15234

Checklist

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • [ ] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.

@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Sep 22, 2026
Comment thread tests/test_sorts.py Outdated
@algorithms-keeper algorithms-keeper Bot added the tests are failing Do not merge until tests pass label Sep 22, 2026
@algorithms-keeper algorithms-keeper Bot removed the tests are failing Do not merge until tests pass label Sep 22, 2026
@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Sep 22, 2026
@cclauss
cclauss merged commit e278aed into TheAlgorithms:master Sep 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants