typedeftemplate's blog

By typedeftemplate, history, 2 years ago, In English

Given a tree in which each vertex represents an interval [x_i, y_i], you can merge adjacent vertices iff they intersect. The merged vertex has a new interval corresponding to the intersection of the previous two intervals, and its neighbors are the union of the neighbors of the merged vertices. How can you minimize the number of vertices after the process terminates?

I tried rooting the tree and attempting dynamic programming, but I’m not sure how to approach this. Any ideas?

  • Vote: I like it
  • +3
  • Vote: I do not like it