2014-05-15

Clarification on Red-Black tree .

'''Originally Posted By: ahmed93'''

I was looking at the slide http://www.cs.sjsu.edu/faculty/pollett/ ... 14.html#(7)<br>Shouldn't the black height of the top node with value 26 be 4 instead of 3 as it says on the slide.<br>It is slide 7

'''Originally Posted By: ahmed93''' I was looking at the slide http://www.cs.sjsu.edu/faculty/pollett/ ... 14.html#(7)<br>Shouldn't the black height of the top node with value 26 be 4 instead of 3 as it says on the slide.<br>It is slide 7

-- Clarification on Red-Black tree

&#039;&#039;&#039;Originally Posted By: dburke&#039;&#039;&#039;

See the first bullet on that slide: the black count doesn&#039;t include the node itself

'''Originally Posted By: dburke''' See the first bullet on that slide: the black count doesn't include the node itself
2014-05-17

-- Clarification on Red-Black tree

&#039;&#039;&#039;Originally Posted By: ahmed93&#039;&#039;&#039;

Yea i realize that but that node has 2 black nodes on the left side and 2black nodes on the right side. 14 and 7 on left and 41 47 on right

'''Originally Posted By: ahmed93''' Yea i realize that but that node has 2 black nodes on the left side and 2black nodes on the right side. 14 and 7 on left and 41 47 on right

-- Clarification on Red-Black tree

&#039;&#039;&#039;Originally Posted By: dburke&#039;&#039;&#039;

But you&#039;re not counting the number of black nodes in any sort of total, you&#039;re counting the number of black nodes in any path from the current node to a NIL leaf node. So if your current node is the root node (key value of 26), all the paths from the current node to a NIL leaf with have a black count of three: 41-47-NIL, 41-38-NIL, 14-7-NIL, 14-12-NIL, 14-16-NIL, 21-19-NIL, 21-23-NIL, 41-28-NIL, all these paths have a black count of 3, giving the root node it&#039;s black height of 3.

'''Originally Posted By: dburke''' But you're not counting the number of black nodes in any sort of total, you're counting the number of black nodes in any path from the current node to a NIL leaf node. So if your current node is the root node (key value of 26), all the paths from the current node to a NIL leaf with have a black count of three: 41-47-NIL, 41-38-NIL, 14-7-NIL, 14-12-NIL, 14-16-NIL, 21-19-NIL, 21-23-NIL, 41-28-NIL, all these paths have a black count of 3, giving the root node it's black height of 3.

-- Clarification on Red-Black tree

&#039;&#039;&#039;Originally Posted By: ahmed93&#039;&#039;&#039;

o ok got it thanks

'''Originally Posted By: ahmed93''' o ok got it thanks
X