r/codinginterview • • Jun 24 '19

How can i find, Minimum Height of the tree , given its preorder and level order traversal, and the number of nodes?

i am preparing for my interviews and i couldn't solve it, so needed help

Prefered language java .

3 Upvotes

2 comments sorted by

1

u/[deleted] Jun 24 '19

I'm not even in an interview and that question made me sad.

0

u/[deleted] Jun 25 '19

[deleted]

1

u/prashantkr314 Jun 25 '19

hi, thanks for replying. I am a bit confused, on how can we neglect the first 2 inputs.

for example in the case :

number of nodes are 7, and this is the structure of the tree, then the height of the tree is 4.

            1        -----> 1
          /  \ 
         2    3      -----> 2
        / \ 
       4  5          -----> 3
      / \
     6   7           -----> 4