Hi also can i have a preorder traversal of the main tree and store the result in an array. Next i run preorder traversal for the subtree to be checked and match each node with the sequence in the array. Ideally both the preorder results should match. This is just another thought with extra space (array) .
Hi Vivekanand. Thank you for your video. I have one question checking for an identical subtree within this problem. Can there also be a true case when the subtree has no more nodes (so p2 == null) but the main tree still has nodes remaining (p1 != null). In this case, the subtree has already been found without traversing all the way down to tree 1's leaf nodes. From your video on checking if a tree is identical, can you explain how the true case (p1 == null && p2 == null) covers the scenario where the subtree has already been found, but nodes remain in the "main" tree? Thank you!
According to the above explanation, no it won't be a subtree because we are checking for the identical tree. ut if the interviewer says to return True, in your case, you have to customize the code.
Sir I will be grateful to u if u post vedio solutions for following questions 1. Inorder transversal of a binary tree without recursion and without stack 2. Program to Construct a binary tree using given inorder and preorder transversal 2.
Sir, Your videos on Dynamic programming are awesome. Please make following videos if possible, Sir : 1) Given a string, determine if a permutation of the string could form a palindrome. 2) Count All Palindrome Sub-Strings in a String 3) Find all distinct palindromic sub-strings of a given string 4) Longest common substring 5) Longest Palindromic Substring 6) Print all palindrome permutations of a string 7) Print all palindromic partitions of a string
You teach slowly , it becomes very easy to grasp the concept. Thank you so much for making videos !! Keep ti up
This man right here deserves all the views. Great tutorial!
Thank you that was extremely helpful!!!
time complexity is o(n*m) where n and m is size of both
Very helpful. Thank you!
Nice video!! Do you have any videos for finding all the permutations possible for a given string?
Thank you so much for amazing explanation :)
Keep it up sir...
but.. time complexity is o(n^2) so this solution will give TLE in coding platform ...
Absolutely informative video.
This is best explanation i have seen so far ...
programming rocks \m/
agreed
Hi also can i have a preorder traversal of the main tree and store the result in an array. Next i run preorder traversal for the subtree to be checked and match each node with the sequence in the array. Ideally both the preorder results should match. This is just another thought with extra space (array) .
Thank you very much !
Hi Vivekanand. Thank you for your video. I have one question checking for an identical subtree within this problem.
Can there also be a true case when the subtree has no more nodes (so p2 == null) but the main tree still has nodes remaining (p1 != null). In this case, the subtree has already been found without traversing all the way down to tree 1's leaf nodes.
From your video on checking if a tree is identical, can you explain how the true case (p1 == null && p2 == null) covers the scenario where the subtree has already been found, but nodes remain in the "main" tree?
Thank you!
According to the above explanation, no it won't be a subtree because we are checking for the identical tree. ut if the interviewer says to return True, in your case, you have to customize the code.
Sir I will be grateful to u if u post vedio solutions for following questions
1. Inorder transversal of a binary tree without recursion and without stack
2. Program to Construct a binary tree using given inorder and preorder transversal
2.
Great tutorial 🔥🔥🔥
Very Good Explanation sir
Play at 1.5x speed.
some algorithms on hashing
can someone elaborate the time and space complexity here?
Time Complexity must be O(n^2) using this concept, as we are checking each subtree of main tree.
Time Complexity O(n)?
Thank you sirji.
Sir, Your videos on Dynamic programming are awesome. Please make following videos if possible, Sir :
1) Given a string, determine if a permutation of the string could form a palindrome.
2) Count All Palindrome Sub-Strings in a String
3) Find all distinct palindromic sub-strings of a given string
4) Longest common substring
5) Longest Palindromic Substring
6) Print all palindrome permutations of a string
7) Print all palindromic partitions of a string
sir, can you do some problems on hashing also
Yes SURE...will make the videos soon.
Make it early as possible sir
I have placement on 31st
whats your status now@@sangappam217
انا عربي وافتهمت شكرا😂😂 فقط من الرسم
Sir
This code only works when subtree is part of main tree till leaf.
We can have a subtree in middle of the main tree. Please revisit
No bro..In the base condition if the s pointer is null, then it returns 1.So it even works when it is in the middle