added an algorithm that merges overlapping intervals in a list