Array and Strings – Geometry – Problem #2
IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive
Difficulty: hard
Problem Statement
Read N (to be read) 2-D coordinate points in two different arrays for X and Y coordinates, respectively. It then reads X and Y coordinates of a point p and compute its closest and furthest points in the list. Print those pairs and their distances from p. It also prints the average distance of N points from p. Provide output for the following input data set. (i) N=4 (1,1), (5.87,5), (1,10.45), (10,1) p=(2.4, 3.8) (ii) N=8 (-1,45.4), (5.8,5), (8,9.45), (-5.12,-67), (3,45.89), (-4,-4.6), (12,-50.12),(50,-50) p=(-5.0, 4.7)