Given a BST, implement a Sibling member variable and initialize them: struct Node { int data; Node* left; Node* right; Node* sibling; }; Such that all Nodes at the same depth point to the one to the right: 5 / \ 3 -> 7 / \ / \ 1 -> 4 -> 6 -> 9
Anonymous
Pretty much just a recursive solution with a depth variable. For every recurse, check the depth and add that Node to vector of that depth and essentially connect all of them across the vector.
Check out your Company Bowl for anonymous work chats.