Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 1.61 KB

README.md

File metadata and controls

29 lines (23 loc) · 1.61 KB

LeetCode_algorithm

About the Tree: full binary tree: A binary tree in which each node has exactly zero or two children. Perfect binary tree: A binary tree with all leaf nodes at the same depth. All internal nodes have degree 2 [1]

The difference between Full Binary Tree & Complete Binary Tree: (1). a binary tree T is full if each node is either a leaf or possesses exactly two child nodes. (2). a binary tree T with n levels is complete if all levels except possibly the last are completely full, and the last level has all its nodes to the left side. [2]

AVL Trees: AVL trees are self-balancing binary search trees. These trees are named after their two inventors G.M. Adel’son-Vel’skii and E.M. Landis. [3]

The height/depth of a tree: The height of a node is the length of the longest downward path to a leaf from that node. The height of the root is the height of the tree. The depth of a node is the length of the path to its root (i.e., its root path). This is commonly needed in the manipulation of the various self-balancing trees, AVL Trees in particular. The root node has depth zero, leaf nodes have height zero, and a tree with only a single node (hence both a root and leaf) has depth and height zero. Conventionally, an empty tree (tree with no nodes, if such are allowed) has depth and height −1.[4]

REF: [1] http://xlinux.nist.gov/dads//HTML/perfectBinaryTree.html [2] http://courses.cs.vt.edu/~cs3114/Fall09/wmcquain/Notes/T03a.BinaryTreeTheorems. [3] http://courses.csail.mit.edu/6.006/fall09/lecture_notes/lecture04.pdf [4] http://www.cs.cmu.edu/~adamchik/15-121/lectures/Trees/trees.html