I have read a good amount of Red-Black tree (wikipedia, …) but still don’t understand what are those colors back and red for.
What is the key purpose of those colors? Why do need need to mark our nodes with such colors?. What happens if we skip that part for a Red-Black tree? Please help.
>Solution :
The purpose of the colors is to ensure the tree remains roughly balanced. With no colors or other invariant to ensure that, in the worst case, you could end up with degenerate trees that are basically just less efficient linked lists.