Binary Tree (binary tree)

1 Overview

  If the number of child nodes for each node in the tree does not exceed 2, it is a binary tree;

2. Features

  CRUD properties are high;

3, a binary search tree (binary sort tree, binary search tree) (Binary Search Tree)

  The value of all the nodes in the left subtree are less than equal to the value of his root;

  Values ​​of all the nodes in the right subtree are greater than or equal to the value of its root node;

  Each node has at most two subtrees;

  There may be a "lame phenomenon" becomes a linked list;

4, balanced binary tree (Balanced Binary Tree / AVLTree)

  Based on a binary search tree, but let the tree is not too high, try to make the tree element equilibrium distribution. Such comprehensive performance will be high;

  Rule: the absolute value of its right and left height difference of not more than two subtrees 1, and left and right sub-trees are a balanced binary tree;

5, red-black tree (Red Black Tree)

  Is a balanced binary search tree;

  feature:

    Each node or red, or black;

    Root node must be black;

    Each leaf node (Nil) is black;

    If a node is red, then its child nodes must be black;

    For each node, the node from the simple to the path of all descendant leaf nodes, contain the same number of black nodes;

  During insertion of the elements, as before; after each insertion is completed, checking rules using black, red and black and if not the rule, it is necessary to adjust the color by, left and right hand tree, red and black to satisfy the rule ;

6, balance multiple search tree (B-Tree)

  

7、B+Tree

  B + Tree is an optimization based on the B-Tree to make it more suitable for implementing the external memory index structure, InnoDB storage engine is to use a B + Tree index implemented its structure.

  

Guess you like

Origin www.cnblogs.com/xp2h/p/12520592.html