What’s wrong with this code?
// case 3\
x->parent->color = BLACK;
x->parent->parent->color = RED;
It ended up causing an infinite loop, and taking me quite a while to figure out why, thinking something was wrong with the tree rotation or logic in the cases. It turns out, I made a type at the end of the comment “// case 3\”, which escaped the newline character even inside the comment, and commented out the next line.
The rightRotate function was broken too, but that’s another story… tree rotations when you have to keep track of parent nodes and worry about 5 possible pointers being NULL isn’t fun.