mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-12 09:39:49 +00:00
Compare commits
10 Commits
a6ad637d6a
...
206e2a06d7
Author | SHA1 | Date | |
---|---|---|---|
|
206e2a06d7 | ||
|
e59d819d09 | ||
|
b6fd43f29e | ||
|
1aac36937e | ||
|
4a9404f6f0 | ||
|
e12524497a | ||
|
153009ea9e | ||
|
fc5411cd44 | ||
|
3064dd13a1 | ||
|
f04ddbb9a6 |
@ -16,13 +16,13 @@ repos:
|
|||||||
- id: auto-walrus
|
- id: auto-walrus
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.9.3
|
rev: v0.9.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
|
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
rev: v2.4.0
|
rev: v2.4.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: codespell
|
- id: codespell
|
||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
|
34
sorts/quantum_bogo_sort.py
Normal file
34
sorts/quantum_bogo_sort.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
def quantum_bogo_sort(arr: list[int]) -> list[int]:
|
||||||
|
"""
|
||||||
|
Quantum Bogo Sort is a theoretical sorting algorithm that uses quantum
|
||||||
|
mechanics to sort the elements. It is not practically feasible and is
|
||||||
|
included here for humor.
|
||||||
|
|
||||||
|
More info:
|
||||||
|
https://en.wikipedia.org/wiki/Bogosort#:~:text=achieve%20massive%20complexity.-,Quantum%20bogosort,-A%20hypothetical%20sorting
|
||||||
|
|
||||||
|
:param arr: list[int] - The list of numbers to sort.
|
||||||
|
:return: list[int] - The sorted list, humorously assumed to be
|
||||||
|
instantly sorted using quantum superposition.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
>>> quantum_bogo_sort([2, 1, 4, 3])
|
||||||
|
[1, 2, 3, 4]
|
||||||
|
|
||||||
|
>>> quantum_bogo_sort([10, -1, 0])
|
||||||
|
[-1, 0, 10]
|
||||||
|
|
||||||
|
>>> quantum_bogo_sort([5])
|
||||||
|
[5]
|
||||||
|
|
||||||
|
>>> quantum_bogo_sort([])
|
||||||
|
[]
|
||||||
|
"""
|
||||||
|
return sorted(
|
||||||
|
arr
|
||||||
|
) # Sorting is assumed to be done instantly via quantum superposition
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
my_array: list[int] = [2, 1, 4, 3]
|
||||||
|
print(quantum_bogo_sort(my_array))
|
Loading…
x
Reference in New Issue
Block a user