# lec10 - Interval Heaps Complete binary tree. Each node...

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

Interval Heaps Complete binary tree. Each node (except possibly last one) has 2 elements. Last node has 1 or 2 elements. Let a and b be the elements in a node P , a <= b . [a, b] is the interval represented by P . The interval represented by a node that has just one element a is [a, a] . The interval [c, d] is contained in interval [a, b] iff a <= c <= d <= b . In an interval heap each node’s (except for root) interval is contained in that of its parent.

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

View Full Document
Interval [c,d] is contained in [a,b] a <= c d <= b a b c d
Example Interval Heap 28,55 35 25,60 30,50 16,19 17,17 50,55 47,58 40,45 40,43 35,50 45,60 15,20 20,70 15,80 30,60 10,90 Left end points define a min heap. Right end points define a max heap.

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

View Full Document
28,55 35 25,60 30,50 16,19 17,17 50,55 47,58 40,45 40,43 35,50 45,60 15,20 20,70 15,80 30,60 10,90 Min and max elements are in the root. Store as an array. Height is ~log n . Example Interval Heap
Insert An Element 28,55 35 25,60 30,50 16,19 17,17 50,55 47,58 40,45 40,43 35,50 45,60 15,20 20,70 15,80 30,60 10,90 Insert 27 . 27,35 New element becomes a left end point. Insert new element into min heap.

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

View Full Document
Another Insert 28,55 35 25,60 30,50 16,19 17,17 50,55 47,58 40,45 40,43 35,50 45,60 15,20 20,70 15,80 30,60 10,90 Insert 18 . New element becomes a left end point. Insert new element into min heap.
28,55 25,35 25,60 30,50 16,19 17,17 50,55 47,58 40,45 40,43 35,50 45,60 15,20 20,70 15,80 30,60 10,90 Insert 18 .

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 12/07/2010 for the course COT 5536 taught by Professor Sartajsahani during the Spring '10 term at University of Florida.

### Page1 / 27

lec10 - Interval Heaps Complete binary tree. Each node...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online