Red-Black Tree
Red-Black Tree Library
nodeKey
represents a price level. Note that Limits for each price level, which track the linked lists of orders, are stored separately from the tree.init
Initializes a red-black tree by setting its root to NULL, size to zero, and minimum and maximum values to their respective extremes.
insert
Inserts a new node with the specified key into the red-black tree, maintaining the tree’s properties and updating the minimum and maximum keys if necessary.
remove
Removes a node with the specified key from the red-black tree, ensuring the tree’s properties are preserved and updating the minimum and maximum keys if necessary.
get
Retrieves the node associated with the specified key from the red-black tree.
contains
Checks if a node with the specified key exists in the red-black tree.
getNextBiggest
Finds the next largest key in the red-black tree that is greater than the specified key.
getNextSmallest
Finds the next smallest key in the red-black tree that is less than the specified key.
assertInvariants
Verifies that the red-black tree satisfies all its invariants, including properties related to node colors, black height, and binary search tree order.