Update quantum_bogo_sort.py to be in compliance with [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md)

This commit is contained in:
Silicon27 2024-10-13 12:37:04 +02:00 committed by GitHub
parent f04ddbb9a6
commit 3064dd13a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,14 +1,29 @@
from typing import List
def quantum_bogo_sort(arr: List[int]) -> List[int]: 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. 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. It is not practically feasible and is included here for humor.
:param arr: List[int] - The list of numbers to sort. :param arr: List[int] - The list of numbers to sort.
:return: List[int] - The sorted list. :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 arr # The elements are already in a superposition of sorted and unsorted states return sorted(arr) # Sorting is assumed to be done instantly via quantum superposition
if __name__ == "__main__": if __name__ == "__main__":
my_array = [2, 1, 4, 3] my_array: List[int] = [2, 1, 4, 3]
quantum_bogo_sort(my_array) print(quantum_bogo_sort(my_array))