about `closest_pair_of_points.py`
What would you like to share?
Firstly, i think there is apparently a typo in line 107:
https://github.com/TheAlgorithms/Python/blob/17059b7ece0e9b2aa0f6e1789d635d6c3eef93ca/divide_and_conquer/closest_pair_of_points.py#L103-L109
The first argument should be points_sorted_on_x rather than points_sorted_on_y.
Then, IMHO, the points_sorted_on_x should be divided into 2 parts too. Otherwise, following part of the algorithm will always take $\Theta(n)$ time in each recursive calls to closest_pair_of_points_sqr , and the total complexity will be $O(n^2)$ then.
https://github.com/TheAlgorithms/Python/blob/17059b7ece0e9b2aa0f6e1789d635d6c3eef93ca/divide_and_conquer/closest_pair_of_points.py#L116-L119
Additional information
No response
you are right. there appears to be a typo in the code snippet you provided. The first argument in the second call to closest_pair_of_points_sqr should be points_sorted_on_x rather than points_sorted_on_y.
In the divide-and-conquer algorithm for finding the closest pair of points, the points_sorted_on_x should also be divided into two parts when splitting the points. this a good way to reduce time complexity of the algo.