The e-commerce company "ShopWithMe" has to do the fastest delivery to its distribution centres due to festive sales. They have the data of all the distribution centre locations in the county. The company has only limited trucks available for deliveries. Therefore, the company wishes — to select the minimum number of straight-line routes that will connect all the distribution locations. To finish the delivery efficiently, trucks will deliver the products to those distribution centres which will be along these straight-line routes only. One truck will cover all the centres along one straight-line route. Write an algorithm to calculate the minimum number of trucks needed by the company.
No of Distribution centre locations: 7
Location (x,y) of distribution centres:
1 4 2 1 0 -2 4 1 4 3 -2 3 1 1
Output : 3
Explanation: The points (2,1), (4,1) and (-1,1) fall on a straight line: the points (4,3),(-2,3) fall on another straight line; and the coordinates (1,4) , (0, -2) fall on a third straight line. Hence there are 3 straight-line routes possible so 3 delivery trucks will be needed __ PS : This test was already finished yesterday