added some information on trees. (#21785)
* added some information on trees. * fixed formatting
This commit is contained in:
committed by
Christopher McCormack
parent
bc4ff23fa8
commit
753198b795
@ -64,9 +64,19 @@ A forest is a set of n ≥ 0 disjoint trees.
|
||||
|
||||
### Some Popular Types of Trees:
|
||||
|
||||
* Binary Tree
|
||||
* Binary Search Tree
|
||||
* AVL Tree
|
||||
- **Binary Tree**. It has the following properties:
|
||||
- The maximum number of nodes at level ‘l’ of a binary tree is 2^l-1.
|
||||
- In Binary tree where every node has 0 or 2 children, number of leaf nodes is always one more than nodes with two children.
|
||||
|
||||
- **Binary Search Tree**. It has the following properties:
|
||||
- The left subtree of a node contains only nodes with keys lesser than the node’s key
|
||||
- The right subtree of a node contains only nodes with keys greater than the node’s key
|
||||
- The left and right subtree each must also be a binary search tree
|
||||
|
||||
- **AVL Tree**. It has the following properties:
|
||||
- Height difference of left and right subtree of node should be less than 2
|
||||
- Re-balancing is done when heights of two child subtrees of a node differ by more than one
|
||||
|
||||
* Red Black Tree
|
||||
* Splay Tree
|
||||
* Huffmann Tree
|
||||
|
Reference in New Issue
Block a user