COT
lec34

# lec34 - Interval Trees i i i i Store intervals of the...

• Notes
• 23

This preview shows pages 1–6. Sign up to view the full content.

Interval Trees Store intervals of the form [ l i ,r i ], l i <= r i . Insert and delete intervals. Version 1 Answer queries of the form: which intervals intersect/overlap a given interval [ l ,r] . Version 2—Variant Report just 1 overlapping interval.

This preview has intentionally blurred sections. Sign up to view the full version.

Definition—Version 1 A binary tree. Each node v has a point v.pt and two lists v.left and v.right . u.pt < v.pt for nodes u in left subtree of v . u.pt > v.pt for nodes u in right subtree of v . So, it is a binary search tree on pt .
Definition—Version 1 Intervals with r i < v.pt are stored in the left subtree of v . Intervals with l i > v.pt are stored in the right subtree of v . Intervals with l i <= v.pt <= r i are stored in v . v.left has these intervals sorted by l i . v.right has these intervals sorted by r i .

This preview has intentionally blurred sections. Sign up to view the full version.

Example v.pt = 4 L = {a, e} R = {d} 1 e 1 3 a 2 4 c 4 6 b 3 6 f 5 7 d 2 4 L R v v.left = {c, f, b} v.right = {c,b,f}
Properties Each interval is stored in exactly one node. Each node stores between 1 and n intervals.

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.
• Spring '10
• sartajsahani
• 1 degree, 4 l, 6 7 L

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern