Convert left-right representation of a binary tree to down-right
Left-Right representation of a binary tree is standard representation where every node has a pointer to left child and another pointer to right child.
Down-Right representation is an alternate representation where every node has a pointer to left (or first) child and another pointer to next sibling. So siblings at every level are connected from left to right.
Given a binary tree in left-right representation as below
1 / \ 2 3 / \ 4 5 / / \ 6 7 8
Convert the structure of the tree to down-right representation like the below tree.