lec21 - Red-Black TreesAgain rank(x) = # black pointers on...

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

View Full Document Right Arrow Icon
Red-Black Trees—Again rank(x) = # black pointers on path from x to an external node. Same as #black nodes (excluding x ) from x to an external node. rank(external node) = 0 .
Background image of page 1

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

View Full DocumentRight Arrow Icon
An Example 10 7 8 1 5 30 40 20 25 35 45 60 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 1 2 2 3
Background image of page 2
Properties Of rank(x) rank(x) = 0 for x an external node. rank(x) = 1 for x parent of external node. p(x) exists => rank(x) <= rank(p(x)) <= rank(x) + 1 . g(x) exists => rank(x) < rank(g(x)) .
Background image of page 3

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

View Full DocumentRight Arrow Icon
Red-Black Tree A binary search tree is a red-black tree iff integer ranks can be assigned to its nodes so as to satisfy the stated 4 properties of rank.
Background image of page 4
(p(x),x) is a red pointer iff rank(x) = rank(p(x)) . (p(x),x) is a black pointer iff rank(x) = rank(p(x)) – 1 . Root is black. Other nodes: Red iff pointer from parent is red. Black iff pointer from parent is black. Given
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 29

lec21 - Red-Black TreesAgain rank(x) = # black pointers on...

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

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