@Decipher -
something like this:

void build_tree(Node*& node, int& index) {
  node = new Node(value[index++]); // create an empty node
  if (label[index] == 'L') return; // we are at leaf, there is no need to 
process further current subtree
  build_tree(node->left, index); // build left and right subtree
  build_tree(node->right, index);
}

here we have arrays value - preorder traversal, and label array - label of 
the node (either L or N).
root = NULL;
index = 0;
build_tree(root, index);

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to