Red black tree

Time:2021-3-6

R-B tree, also known as red black tree, is a special binary search tree. Each node of the red black tree has a storage bit to represent the color of the node, which can be red or black. The characteristics of red black tree are as follows

Nodes are red or black.
The root node is black.
Each leaf node (NIL node, empty node) is black.
The two children of each red node are black. (all paths from each leaf to the root cannot have two consecutive red nodes)
All paths from any node to each leaf contain the same number of black nodes.

Red black tree

Recommended Today

Third party calls wechat payment interface

Step one: preparation 1. Wechat payment interface can only be called if the developer qualification has been authenticated on wechat open platform, so the first thing is to authenticate. It’s very simple, but wechat will charge 300 yuan for audit 2. Set payment directory Login wechat payment merchant platform( pay.weixin.qq . com) — > Product […]