Construct a special tree from given preorder traversal
Given an array βpre[]β that represents Preorder traversal of a spacial binary tree where every node has either 0 or 2 children. One more array βpreLN[]β is given which has only two possible values βLβ and βNβ. The value βLβ in βpreLN[]β indicates that the corresponding node in Binary Tree is a leaf node and value βNβ indicates that the corresponding node is non-leaf node. Write a function to construct the tree from the given two arrays.
Example:
Last updated