Given two binary trees with head reference asTandShaving at mostNnodes. The task is to check if S is present as subtree in T.A subtree of a tree T1 is a tree T2 consisting of a node in T1 and all of its descendants in T1
You don't need to read input or print anything. Your task is to complete thefunction isSubtree()that takes root node of S and T as parametersandreturns 1if S is a subtree of T else0.
Expected Time Complexity:O(N).Expected Auxiliary Space:O(N).
Constraints:1 <= number="" of="" nodes="">=><=>=>51 <= value="" of="" nodes="">=><=>=>4
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here