I found a short tutorial on ‘how to use Rede-Black Tree kernel’s data structure‘ . The data structure can be found in **linux/rbtree.h**. (kernel library)

*“Red-black trees are a type of self-balancing binary search tree, used for storing sortable key/value data pairs. This differs from radix trees (which are used to efficiently store sparse arrays and thus use long integer indexes to insert/access/delete nodes) and hash tables (which are not kept sorted to be easily traversed in order, and must be tuned for a specific size and hash function where rbtrees scale gracefully storing arbitrary keys).” [Got from here]*

*“In addition to the requirements imposed on a binary search tree the following must be satisfied by a red–black tree:*

*A node is either red or black.*
*The root is black. This rule is sometimes omitted. Since the root can always be changed from red to black, but not necessarily vice versa, this rule has little effect on analysis.*
*All leaves (NIL) are black.*
*If a node is red, then both its children are black.*
*Every path from a given node to any of its descendant NIL nodes contains the same number of black nodes. The uniform number of black nodes in the paths from root to leaves is called the ***black-height** of the red–black tree.” [Wikipedia]

### Like this:

Like Loading...

*Related*