- Insert an edge connecting all the sibling of the given n-ary tree.
- Delete all the parent edges from the parent to its children except the one to its leftmost child.
- Rotate the resulting tree by 45degress to differentiate between its left and right subtree.
The Time Complexity of converting an m-ary tree to Binary tree is O(N + E), N is the number of nodes in the tree and E is the number of the edges in the intermediate tree created after step 1.
Preorder, Inorder & Postorder of the resultant tree are
Preorder: V1, V2, V5, V6, V3, V4, V7, V9, V10, V11, V8
Inorder: V5, V6, V2, V3, V9, V10, V11, V8, V4, V1
Postorder: V6, V5, V11, V10, V9, V8, V7, V4, V3,V2, V1