So I just learned red black trees at Cormen and wow! Typically I like to understand all algorithms and data structures to the point I can rebuild them from scratch without having to cheat looking at the pseudo code. I really like algorithms so I enjoy learning how they work and I usually go line by line and try some cases by looking at the code and checking if what's happening is what I understood that should happen.
Just understanding what's happening took me A LOT of time for RB trees. Even with the explanations of the book, I still found it hard to grasp the code. Not to mention that I couldn't understand how/why rotations work. I don't find it intuitive at all. I mean, the three (six actually) different cases for insertion and then the 4 cases for deletion? Is it possible to understand this thing? It's impossible for me to rebuild this code without cheating. Until binary tree I could implement the stuff out of my head, with some tweaking it would always work, but RB trees I'm not even going to try. I mean, even the teacher got confused sometimes so I suppose it's really not that easy, but at the same time, shouldn't we have to understand everything that's happening or at least why? The book didn't really explain how someone came up with the idea of rotations. How did someone notice that with 2 rotations you could solve any insertion problem? That's amazing!
My question is, do I really have to 100% understand RB trees? I feel kind of bad skipping stuff without fully understanding it. Thanks in advance guys! (PS: there's no tag for RB-tree, actually not even for tree, just binary-tree, so I only put algorithms)