Finding the Closest Pair of Points Problem: Given n ordered pairs x1, y


Now, let's call rec_cl_pair on the set



Download 59 Kb.
Page7/10
Date16.05.2021
Size59 Kb.
1   2   3   4   5   6   7   8   9   10
Now, let's call rec_cl_pair on the set
{(3, 4), (5, 1), (6, 7), (7, 4), (8, 0)}
We first make two recursive calls to the sets: {(3, 4), (5, 1)} and {(6, 7), (7, 4), (8, 0)}. The first will result in deltaL being set to and the points getting sorted by y: {(5, 1), (3, 4)}.

The second results in delta being set to and the points getting sorted by y: {(8, 0), (7, 4), (6, 7)}. We then merge all of these points: {(8, 0), (5, 1), (3, 4), (7, 4), (6, 7)}. All of these points get copied into v.
Then, we discover that NO pair of points beats the original deltaR of . This is then the closest distance between any pair of points within the second set of data.



Share with your friends:
1   2   3   4   5   6   7   8   9   10




The database is protected by copyright ©essaydocs.org 2020
send message

    Main page