Saturday, October 18, 2008

Reverse Binary Tree

Node[] Reverse(Node root)

so for the tree below, out put shd be Array with 4 roots L1,L2,L3,L4

Input Tree:

R
C1 C2
L1 L2 L3 L4

Output tree: (Its No more binary tree, looks like a 4 linked list where L1,L2 share common Node C1 and R, and L3 L4 has common node C2 and R)

L1 L2 L3 L4
C1 C2
R

No comments: