mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 15:01:08 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
851c740d21
commit
1f470e7932
|
@ -22,8 +22,7 @@ def distance(a: Point, b: Point) -> float:
|
||||||
is {distance(point1, point2)}")
|
is {distance(point1, point2)}")
|
||||||
Distance from Point(2, -1, 7) to Point(1, -3, 5) is 3.0
|
Distance from Point(2, -1, 7) to Point(1, -3, 5) is 3.0
|
||||||
"""
|
"""
|
||||||
return math.sqrt(abs((b.x - a.x) ** 2 + (b.y - a.y) ** 2
|
return math.sqrt(abs((b.x - a.x) ** 2 + (b.y - a.y) ** 2 + (b.z - a.z) ** 2))
|
||||||
+ (b.z - a.z) ** 2))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -35,8 +35,7 @@ def quick_sort(collection: list) -> list:
|
||||||
|
|
||||||
lesser_partition, greater_partition = partition(collection, pivot)
|
lesser_partition, greater_partition = partition(collection, pivot)
|
||||||
|
|
||||||
return [*quick_sort(lesser_partition), pivot,
|
return [*quick_sort(lesser_partition), pivot, *quick_sort(greater_partition)]
|
||||||
*quick_sort(greater_partition)]
|
|
||||||
|
|
||||||
|
|
||||||
def partition(collection: list, pivot) -> tuple[list, list]:
|
def partition(collection: list, pivot) -> tuple[list, list]:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user