Amazon interview question

Write a code to determing whether a binary tree is symmetric or not (symmetricity is based on data i.e., folding the tree with respect to the root node, all the leaf nodes which overlap should have same data)

Interview Answers

Anonymous

27 Apr 2011

The Strings generated by doing a pre-order and post-order traversals should be reverse of each other

1

Anonymous

1 Apr 2012

a pre-order traversal is enough, is the string is symmetric , then the tree is symmetric

Anonymous

7 Jan 2013

If we do an inorder traversal and the result string is a palindrome, then the tree is symmetric