[pre-commit.ci] pre-commit autoupdate (#11322)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.2...v0.3.2) - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5f95d6f805
commit
bc8df6de31
@@ -3,6 +3,7 @@ Python program for Bitonic Sort.
|
||||
|
||||
Note that this program works only when size of input is a power of 2.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ If k = O(n), time complexity is O(n)
|
||||
|
||||
Source: https://en.wikipedia.org/wiki/Bucket_sort
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ For manual testing run:
|
||||
python dnf_sort.py
|
||||
"""
|
||||
|
||||
|
||||
# Python program to sort a sequence containing only 0, 1 and 2 in a single pass.
|
||||
red = 0 # The first color of the flag.
|
||||
white = 1 # The second color of the flag.
|
||||
|
||||
@@ -18,8 +18,7 @@ from typing import Any, Protocol, TypeVar
|
||||
|
||||
|
||||
class Comparable(Protocol):
|
||||
def __lt__(self, other: Any, /) -> bool:
|
||||
...
|
||||
def __lt__(self, other: Any, /) -> bool: ...
|
||||
|
||||
|
||||
T = TypeVar("T", bound=Comparable)
|
||||
|
||||
@@ -3,6 +3,7 @@ Introspective Sort is a hybrid sort (Quick Sort + Heap Sort + Insertion Sort)
|
||||
if the size of the list is under 16, use insertion sort
|
||||
https://en.wikipedia.org/wiki/Introsort
|
||||
"""
|
||||
|
||||
import math
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ It used the binary representation of the integers to sort
|
||||
them.
|
||||
https://en.wikipedia.org/wiki/Radix_sort
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ comparisons.
|
||||
They are synchronized with locks and message passing but other forms of
|
||||
synchronization could be used.
|
||||
"""
|
||||
|
||||
from multiprocessing import Lock, Pipe, Process
|
||||
|
||||
# lock used to ensure that two processes do not access a pipe at the same time
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
"""
|
||||
This is an implementation of Pigeon Hole Sort.
|
||||
For doctests run following command:
|
||||
This is an implementation of Pigeon Hole Sort.
|
||||
For doctests run following command:
|
||||
|
||||
python3 -m doctest -v pigeon_sort.py
|
||||
or
|
||||
python -m doctest -v pigeon_sort.py
|
||||
python3 -m doctest -v pigeon_sort.py
|
||||
or
|
||||
python -m doctest -v pigeon_sort.py
|
||||
|
||||
For manual testing run:
|
||||
python pigeon_sort.py
|
||||
For manual testing run:
|
||||
python pigeon_sort.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ python3 -m doctest -v quick_sort.py
|
||||
For manual testing run:
|
||||
python3 quick_sort.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from random import randrange
|
||||
|
||||
@@ -3,6 +3,7 @@ This is a pure Python implementation of the radix sort algorithm
|
||||
|
||||
Source: https://en.wikipedia.org/wiki/Radix_sort
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
RADIX = 10
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
A recursive implementation of the insertion sort algorithm
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ in their paper Pessimal Algorithms and Simplexity Analysis
|
||||
|
||||
Source: https://en.wikipedia.org/wiki/Slowsort
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ Tree_sort algorithm.
|
||||
|
||||
Build a Binary Search Tree and then iterate thru it to get a sorted list.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterator
|
||||
|
||||
Reference in New Issue
Block a user