File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/_DataStructures_/Trees/BinaryTree/check-binary-tree-subtree-another-binary-tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1+ // Check if a binary tree is subtree of another binary tree
2+ // Root of the source tree and the tree to be matched are provided in the parameters.
3+ // Return true/false based on whether or not the given tree is the subtree of the source tree
4+ // Time complexity : O(m*n) m is the number of nodes of the original tree,
5+ // n is the number of nodes in the tree to be matched
6+
17function areIdentical ( rootOfOriginalTree , rootOfMatchingTree ) {
28 if ( rootOfOriginalTree === null && rootOfMatchingTree === null ) {
39 return true ;
410 }
511
6- if ( Roo1 === null || rootOfMatchingTree === null ) {
12+ if ( rootOfOriginalTree === null || rootOfMatchingTree === null ) {
713 return false ;
814 }
915
You can’t perform that action at this time.
0 commit comments