From 753198b79585e3234effa4f5604c643c4b5bd4e8 Mon Sep 17 00:00:00 2001 From: Aheli Ghosh <34214861+Ahelii16@users.noreply.github.com> Date: Sat, 17 Nov 2018 21:42:29 +0530 Subject: [PATCH] added some information on trees. (#21785) * added some information on trees. * fixed formatting --- .../data-structures/trees/index.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/guide/english/computer-science/data-structures/trees/index.md b/guide/english/computer-science/data-structures/trees/index.md index 916169952e..42dad45bbd 100644 --- a/guide/english/computer-science/data-structures/trees/index.md +++ b/guide/english/computer-science/data-structures/trees/index.md @@ -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