Skip to content

Commit 5812640

Browse files
rsun0013harshildarji
authored andcommitted
pytests for closest_pair_of_points.py (TheAlgorithms#1099)
added some tests to the file
1 parent 22d2453 commit 5812640

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

divide_and_conquer/closest_pair_of_points.py

+13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@
1919
Time complexity: O(n * log n)
2020
"""
2121

22+
"""
23+
doctests
24+
>>> euclidean_distance_sqr([1,2],[2,4])
25+
5
26+
>>> dis_between_closest_pair([[1,2],[2,4],[5,7],[8,9],[11,0]],5)
27+
5
28+
>>> dis_between_closest_in_strip([[1,2],[2,4],[5,7],[8,9],[11,0]],5)
29+
85
30+
>>> points = [(2, 3), (12, 30), (40, 50), (5, 1), (12, 10), (3, 4)]
31+
>>> print("Distance:", closest_pair_of_points(points, len(points)))
32+
"Distance: 1.4142135623730951"
33+
"""
34+
2235

2336
def euclidean_distance_sqr(point1, point2):
2437
return (point1[0] - point2[0]) ** 2 + (point1[1] - point2[1]) ** 2

0 commit comments

Comments
 (0)