Question: Write a program to find the mirror image of a n-ary tree( may or may not binary)

Solution: Tnode MirrorTree(TNode tnode)
{
// Don't do anything if the number of children is less than one
if(tnode.Children.Count < 2) return tnode;
// else push the children into a stack and set that as children
List children = tnode.Children;
List stack = new List;
foreach(TNode t in children){
stack.insertAt(0,MirrorTree(t));
}
t.Children = stack;
children = null;
return tnode;
}