Java-- binary / binary balance / black tree / B Trees / B + Trees

First, the definition of tree:

  A set of hierarchical relationship consists of nodes; so long as the tree is called a tree;

  Tree line and Artifact: https://www.cs.usfca.edu/~galles/visualization/

Second, the binary tree:

  Characteristics: 1) values ​​of all the nodes left subtree are less than the value of the root node;

    2) the right subtree are greater than values ​​of all the nodes of the root node and its value;

  Example: the formation of a good chain structure;

  

Third, the balanced binary tree (AVL):

  Characteristics: 1) on the basis of the binary tree, requires a high degree of difference between two subtrees shall not exceed 1;

    1) each deletions will be by one or more rotations balanced binary tree;

  Example: reinsert 123456 node;

  

Fourth, the red-black tree:

  Characteristics: 1) node either black or red;

    2) a timing black root;

    3) All leaf nodes are null, and black;

    Two child nodes 4) Red nodes are black, no two consecutive red;

    5) Black any nodes on the path, the time constant equal;

  ps: The Java terrMap and treeSet red-black tree is achieved;

  

五、B Trees/B+ Trees:

  1) Each node has a plurality of values, two binary bits, three of the trigeminal, exceeding this value requires molecular node;

  2) Balance nodes allow reading the depth decreases the number of IO path be reduced;

  3) the balance data into the memory node is determined, it is faster;

  

六、B+ Trees

  mysql index is B + Trees achieved;

  Features: 1) there is no non-cotyledonary node data, only the index;

    2) so that regardless of check data, should be obtained from the leaf node, the number of times each query are the same;

    3) reads the value of the index mysql, hash calculation only once, so the speed is faster than the B Tree;

 

Guess you like

Origin www.cnblogs.com/Tractors/p/11275422.html