RedBlackTree_II

RedBlackTree II Chinese version address

The Last Section

Basic operation of red black trees

Insert

Insert a node into the red-black tree, which steps need to be performed?

  1. think of the red-black tree as a binary search tree and insert the node.
  2. Set this node to red.
  3. Modify the tree by rotating and recoloring it to make it a red-black tree again.

Read More

Share

RedBlackTree I

RedBlackTree I Chinese version address

Binary Tree Review

There are several features of binary tree:

  1. if the left subtree of any nodes is not null, the value of all nodes on the left subtree is less than the value of its root node.
  2. if the right subtree of any nodes is not null, the value of all nodes on the right subtree is greater than the value of its root node.
  3. the left and right subtrees of any node are also binary tree.
  4. No nodes with equal values

Red Black Tree Overview

Red Black Tree is a special binary tree. each node of a red black tree has a bit to represenet the color, which can be red or black.

Read More

Share