Written in front of the words:
authors from graduate has been involved in game development, with many games and practical case module code for all to study and exchange, hope the knowledge can bring some help, if you have any questions, please add group 641 792 143 exchanges and learning or No micro-channel public concern programmer dry area
Road have been heard, industry specializing in surgery, I hope you have educated us
First, tell us about the red-black tree Some properties:
Property 1: root is black
nature 2: each leaf node is black (refers to the empty leaf node)
Property 3: two children each red node must be black
( child nodes must be present or absent)
nature 4: a path of any node to each leaf node contains the same number of black nodes (non-empty leaf node)
nature 4.1: if a node exists black child nodes, then the node sure there are two child nodes (otherwise black imbalance)
extended 5: can not have two red nodes connected to
Red-black tree is a binary search tree, but not perfectly balanced, just black perfect balance.
Red-black tree to achieve self-balancing in three ways: L, D, discoloration.
1. Find a red-black tree
Because the red-black tree is a binary search tree, which satisfies the binary search rule, should not know, refer to the principle blog AVL tree analysis.
2. The red-black tree insertion
3. Delete the red-black tree node
These are the most important theoretical part of the red-black tree, if desired code, plus the beginning of the article group number