22. What is balance tree, do you know red-black tree?
A tree is called as balance tree if the difference between heights of left subtree and right subtree is not more than 1.
A Red-Black Tree is a self-balancing Binary Search Tree (BST) where every node follows the below following rules.
1) Every node has a color either red or black.
2) Root of tree is always black.
3) There are no two adjacent red nodes (A red node cannot have a red parent or red child).
4) Every path from root to a NULL node has same number of black nodes.
Ram
8 Jul, 2018 10:58 PM
A tree is called as balance tree if the difference between heights of left subtree and right subtree is not more than 1.
A Red-Black Tree is a self-balancing Binary Search Tree (BST) where every node follows the below following rules.
1) Every node has a color either red or black.
2) Root of tree is always black.
3) There are no two adjacent red nodes (A red node cannot have a red parent or red child).
4) Every path from root to a NULL node has same number of black nodes.
Report Error
Report Error
Please Login First Click Here