Skip to content

sorts: type six algorithms for comparable items - #15246

Closed
HarshRajSinghania wants to merge 1 commit into
TheAlgorithms:masterfrom
HarshRajSinghania:sorts/comparable-sorts-batch
Closed

sorts: type six algorithms for comparable items#15246
HarshRajSinghania wants to merge 1 commit into
TheAlgorithms:masterfrom
HarshRajSinghania:sorts/comparable-sorts-batch

Conversation

@HarshRajSinghania

Copy link
Copy Markdown
Contributor

Part of #15234

Update six comparison sorts to use bounded Comparable type parameters and exercise non-integer comparable inputs.

Included algorithms:

  • cocktail_shaker_sort.py
  • comb_sort.py
  • cycle_sort.py
  • double_sort.py
  • exchange_sort.py
  • gnome_sort.py

Changes:

  • Replace unbounded/int-only annotations with the Comparable protocol pattern.
  • Add string and float doctests.
  • Register the six algorithms in the shared sorting test suite.

Validation performed:

  • All six modified modules pass their doctests.
  • AST parsing succeeds for all modified sort modules.
  • Direct runtime checks confirm string/float sorting and TypeError for mixed incomparable values.

@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label Sep 9, 2026
@algorithms-keeper

Copy link
Copy Markdown

Closing this pull request as invalid

@HarshRajSinghania, this pull request is being closed as none of the checkboxes have been marked. It is important that you go through the checklist and mark the ones relevant to this pull request. Please read the Contributing guidelines.

If you're facing any problem on how to mark a checkbox, please read the following instructions:

  • Read a point one at a time and think if it is relevant to the pull request or not.
  • If it is, then mark it by putting a x between the square bracket like so: [x]

NOTE: Only [x] is supported so if you have put any other letter or symbol between the brackets, that will be marked as invalid. If that is the case then please open a new pull request with the appropriate changes.

@algorithms-keeper algorithms-keeper Bot closed this Sep 9, 2026
@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Sep 9, 2026
@cclauss

cclauss commented Sep 9, 2026

Copy link
Copy Markdown
Member

ONE ALGORITHM PER PULL REQUEST like it says in:

  1. The issue
  2. The pull request template
  3. CONTRIBUTING.md

@HarshRajSinghania

Copy link
Copy Markdown
Contributor Author

You're absolutely right — sorry about that. I missed the explicit one-algorithm-per-PR guidance in the issue, PR template, and CONTRIBUTING.md.

I’ve closed out the batch approach and split the work into six separate PRs, one algorithm per PR:

The replacement PRs are based on the current upstream master and each contains only its single algorithm change plus the corresponding mixed-type test. Thanks for calling this out.

@cclauss

cclauss commented Sep 9, 2026

Copy link
Copy Markdown
Member

The goal is to spread the workload so multiple visitors can learn how to make these changes.

If one person does them all, others lose the opportunity to learn by doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants