The rebalancing loop of the insert operation has the following invariant: The variable N, representing the current node N and initially the insertion node, is made the variable running through the loop. N is File:RedNode.svg (red) at the beginning of each iteration. Requirement 3 is satisfied for all pairs node←parent with the possible exception N←P when P is also red (a red-violation at N). All other properties (including requirement 4) are satisfied throughout the tree.
The rebalancing loop of the insert operation has the following invariant The: variable N, representing the current node N and initially the insertion node, is made the variable running through the loop. N is File:RedNode.svg (red) at the beginning of each iteration. Requirement 3 is satisfied for all pairs node←parent with the possible exception N←P when P is als.o red (a red-violation at N). All other properties (including requirement 4) are satisfied throughout the tree