I have a question regarding the solution provided by Karolis Juodel.Given in this question; Colour a binary tree to be a red-black treeBlack = black nodes, white = red nodesSo for this tree when I try to manually work out the code, it seems to fail on the node 17. E.G. I have a black quota of 3 so I color the root black. Afterwards I go to the left child (17) and that has the same min height (namely 17 - 21 - 23) -> so I color this black. After this black colour I cannot see how I will end up with a valid tree with 1 black node left.So if you could provide how to solve it for this example that would be great!
Binary tree To Red-Black tree
data structures;binary trees;search trees;balanced search trees