Problem statement Given N intervals S = {e1,e2,.....en} each event has start and end time. Merge all overlapping intervals. Events i and j overlap when start time of jth event is less than end time of ith event or vice-a-versa For example, [(1, 3), (2, 4), (5, 8)] should be transformed into [(1, 4), (5,8)] Analysis This problem is quite simple but through this problem we can understand concept of stacks and array. Let's see brute force solution. We take ith event and compare start time of every jth event with end time of ith,
Read full article from Algorithms and Me: Arrays : Merge overlapping intervals.
No comments:
Post a Comment