Data Structure and Algorithm
Data Structure and Algorithm
Both the Closest Pair Problem and the Convex Hull Problem are
fundamental computational geometry problems, but they have different
objectives and brute force approaches.
A city council wants to mark the boundaries of a city using GPS points: (2, 2), (3,
6), (5, 3), (7, 7), (8, 2), and (6, 4). They need to find the convex hull to
determine the city's outer limits.
Solution:
The convex hull consists of the points forming the outer boundary of the city:
o The points forming the convex hull are (2,2), (3,6), (7,7), (8,2).
o The other points (5,3) and (6,4) are inside and are not part of the
convex hull.
Explorers want to mark the boundary of a mountain range based on their survey
points: (0,0), (2,1), (3,4), (1,3), (5,5), and (4,2). They need to find the convex
hull to outline the range.
Solution:
The convex hull consists of the outermost points:
o The points forming the convex hull are (0,0), (2,1), (3,4), (5,5).
o The points (1,3) and (4,2) lie inside the convex hull.