algorithms.tutorialhorizon.com

Check if interval is covered in given coordinates | Algorithms

Objective: Given 1-D list of coordinates, (x1, x2), (x3, x4), , , ,(xn-1, xn)and interval (a, b). Write an algorithm to determine if interval (a,b) is covered in the list of coordinates. Example: Coordinates - [(2,5), (5,7),(1,4)] and interval = (1,6) Return true Explanation - Points 1 to 6 lies in list of interval given 1 to 4. 2 to 5 and 5 to 7.