added some information on trees. (#21785)

* added some information on trees.

* fixed formatting
This commit is contained in:
Aheli Ghosh
2018-11-17 21:42:29 +05:30
committed by Christopher McCormack
parent bc4ff23fa8
commit 753198b795

View File

@ -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 nodes key
- The right subtree of a node contains only nodes with keys greater than the nodes 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