e49caf57d0 types(reverse_selection): constrain items to Comparable (#15410)
* types(reverse_selection): constrain items to Comparable

Bind reverse_selection_sort's element type to a Comparable Protocol so the
signature says "a list of items that can be compared with each other"
instead of a bare list, and keep the element type in the return.

reverse_subarray only swaps elements and never compares them, so its
TypeVar stays unbounded.

Also adds doctests for a comparable non-int type (strings, floats) and for
the failure mode: mixing non-comparable items must raise TypeError rather
than silently mis-sort. The test battery picks the sort up for the shared
cases and for the rejection check.

* updating DIRECTORY.md

---------

Co-authored-by: AuroraAeon <auroraeon@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
Co-authored-by: cclauss <cclauss@users.noreply.github.com>
2026-09-24 22:09:11 +02:00
2026-09-13 23:01:39 +02:00
2026-09-24 14:21:50 +02:00
2026-09-05 20:05:56 +02:00

The Algorithms - Python

Gitpod Ready-to-Code Contributions Welcome Discord chat
GitHub Workflow Status pre-commit code style: black

All algorithms implemented in Python - for education 📚

Implementations are for learning purposes only. They may be less efficient than the implementations in the Python standard library. Use them at your discretion.

🚀 Getting Started

📋 Read through our Contribution Guidelines before you contribute.

🌐 Community Channels

We are on Discord! Community channels are a great way for you to ask questions and get help. Please join us!

📜 List of Algorithms

See our directory for easier navigation and a better overview of the project.

Languages
Python 99.8%
Shell 0.2%