Red Black Tree Restructure
I guess this is more of a general programming question rather than a C question but since the project is in C I thought I would post it here. In a RedBlack tree when we do a removal or insertion we sometimes have to do a restructure, which calls for naming the leftmost node in the subtree of x,y,z, A as found by an inorder traversal, B would then be the next leftmost node and C would be rightmost node. Here is my question: can I just compare the keys of each of the three nodes x,y,z and label them as A,B,C the lowest being A, and so on? I cannot think of any case where this would not work so if someone knows I would sure appreciate the help.
3 6 11 18
Now if we have a double red between 10-4-6 we could just take A to be the lowest key of the three nodes, B would be the second and so on. This seems correct to me but I may be missing something. Thanks