deepansh
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
1
/ \
2 3
/ / \
6 2 4
/ \
4 2
Here 2,4 and 4,2 have the same signature which is NI4INI2IN, so it produces a match, but actually they are not the same. So, it gives the wrong match. You should use the signature= {node.value+"I"+lvalue+"I"+rvalue}, as it will always be unique.
- deepansh March 10, 2017Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Your concept is correct, except for the fact that you also need to add "NULL" or any number representing null to the list of children. This is because if you don't add "NULL" then the order of the children will not be proper. For e.g
this will give you "its a mirror" whereas it is "not a mirror".
- deepansh March 12, 2017