Skip to content

Tree

Tree是一种非线性的数据结构(1 to many), 和我们以前接触的

常见树的分类:

name chinese name definition
Perfect Binary Tree 完美二叉树 Every node except the leaf nodes have two children and every level (last level too) is completely filled. 最完美的.
Complete Binary Tree 完全二叉树 在heap的时候接触过这个概念,自上而下,自左向右填充的. Every level except the last level is completely filled and all nodes are left justified (左对齐,left -> right). complete binary tree比perfect binary tree的条件来的relax一点.
Full/Strictly Binary Tree 完满二叉树 Every node except the leaf nodes have two children. 甚至都不用从左到右,从上到下fill, 你只要有2 children就好. 更relax

BST (binary search tree)