Prove D&C closest-pair runs in O(n log n)
Analyze the prove d&c closest-pair runs in o(n log n).
Examples
Input: "test_input_1"
Output: "output_1"
Input: "test_input_2"
Output: "output_2"
Hints
Recall that the divide and conquer approach splits the problem into two halves, each of size n/2, and the conquer step involves merging these solutions. How does the merging step contribute to the overall time complexity?
The key to proving the time complexity lies in analyzing the recurrence relation derived from the divide and conquer steps. Write down the recurrence relation for this algorithm and attempt to solve it using the Master Theorem or recursion tree method.
Consider the geometric constraints of the problem. Specifically, how does the strip of width 2d (where d is the minimum distance found so far) around the dividing line affect the number of comparisons needed in the merging step? Can you bound this number to ensure the overall time complexity remains o(n log n)?
Prove D&C closest-pair runs in O(n log n)
Analyze the prove d&c closest-pair runs in o(n log n).