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

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

View Full Document Right Arrow Icon
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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Interval [c,d] is contained in [a,b] a <= c d <= b a b c d
Background image of page 2
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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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.
Background image of page 5

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

View Full DocumentRight Arrow Icon
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.
Background image of page 6
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 .
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
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 Right Arrow Icon
Ask a homework question - tutors are online