problem : given preorder and inorder traversal of a binary tree , generate the tree from it.
solution:
lets take the basic case first
given: inorder and preorder traversals of a tree in array form
assuming tree to be having unique elements only
returns the head pointer to the tree generated
output at code on ideone
No comments:
Post a Comment