Reputation: 1704
I was asked in a homework assignment to answer a question regarding "Red-Red-Black" trees. The description of a red-red-black tree (copied from somewhere in the internet) is:
"A red-red-black tree is a binary search tree that satisfies the following conditions:
I was asked, given a red-red-black tree with n nodes, what is the largest number of internal nodes with black-height k? What's the smallest number?
I've been trying to think about it for more then two hours now, but apart from headache I couldn't get anywhere.
Thanks!
Upvotes: 1
Views: 1091
Reputation: 387
maximum number of nodes : (2^2k)-1
minimum number of nodes : (2^k)-1
Upvotes: 1
Reputation: 641
Two Red Node can never appear continuously. Number of Black node should be equal in when you traverse through any path.
Upvotes: 0