2 Commits
Author SHA1 Message Date
KratosandChristian Clauss f59bddb055 fix(sorts): make smoothsort generic over Comparable items (#15441)
* fix(sorts): make smoothsort generic over Comparable items

* The TypeVar is no longer needed.

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2026-09-26 10:13:40 +02:00
Pranav M S Krishnanandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 195ad61be1 Add Smoothsort algorithm implementation (#13534)
* Add Smoothsort algorithm implementation

This adds the Smoothsort adaptive sorting algorithm by Edsger Dijkstra. It runs in O(n log n) worst case and O(n) when data is nearly sorted.

* Fix formatting and helper function compliance for Smoothsort

Updated comments and documentation for clarity on the smoothsort algorithm. Refactored internal helper function name and removed redundant code for Leonardo numbers.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixing errors and re-implementing the algorithm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update comments to use colons instead of dashes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-09-09 14:23:17 +02:00