lecture18-Heaps

lecture18-Heaps - 45 32 30 24 23 22 50 48 31 17 44 8 29 10...

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

View Full Document Right Arrow Icon
Binomial Heaps These lecture slides are adopted from CLRS, Chapters 6, 19. Source: internet Lecture 18
Background image of page 1

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

View Full DocumentRight Arrow Icon
Representing Binomial Heaps parent key degree child sibling Each node is represented by a structure like this 10 25 18 12 1 27 17 38 11 29 14 8 6 2
Background image of page 2
3 Binomial Heap: Properties Properties of N-node binomial heap. Min key contained in root of B 0 , B 1 , . . . , B k . Contains binomial tree B i iff b i = 1 where b n b 2 b 1 b 0 is binary representation of N. At most log 2 N + 1 binomial trees. Height log 2 N . 55 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 37 3 18 N = 19 # trees = 3 height = 4 binary = 10011
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Binomial Heap: Union Create heap H that is union of heaps H' and H''. "Mergeable heaps." Easy if H' and H'' are each order k binomial trees. connect roots of H' and H'' choose smaller key to be root of H H'' 55 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 H'
Background image of page 4
5 Binomial Heap: Union 0 0 1 1 1 0 0 1 + 0 1 1 1 1 1 1 1 0 1 19 + 7 = 26 55 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 37 3 18 41 33 28 15 25 7 12 +
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 Binomial Heap: Union 55 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 37 3 18 41 33 28 15 25 7 12 +
Background image of page 6
7 Binomial Heap: Union 55 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 37 3 41 33 28 15 25 7 + 12 18 18 12
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 55
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

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

View Full DocumentRight Arrow Icon
Background image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 37 3 41 33 28 15 25 7 + 12 18 25 37 7 3 18 12 18 12 9 55 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 37 3 41 33 28 15 25 7 12 + 18 25 37 7 3 41 28 33 25 37 15 7 3 18 12 18 12 10 55 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 37 3 41 33 28 15 25 7 + 18 12 41 28 33 25 37 15 7 3 12 18 25 37 7 3 41 28 33 25 37 15 7 3 18 12 11 55 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 37 3 41 33 28 15 25 7 + 18 12 41 28 33 25 37 15 7 3 12 18 25 37 7 3 41 28 33 25 37 15 7 3 55 45 32 30 24 23 22 50 48 31 17 44 8 29 10 6 18 12 12 Binomial Heap: Union Create heap H that is union of heaps H' and H''. ■ Analogous to binary addition. Running time. O(log N) ■ Proportional to number of trees in root lists ≤ 2( log 2 N + 1). 1 1 1 1 + 1 1 1 1 1 1 1 1 19 + 7 = 26...
View Full Document

This note was uploaded on 03/30/2011 for the course CS 6713 taught by Professor Su during the Spring '11 term at Arkansas State.

Page1 / 12

lecture18-Heaps - 45 32 30 24 23 22 50 48 31 17 44 8 29 10...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online