Skip to content

Commit 0f596d8

Browse files
committed
Description added and variable fix
1 parent a999b0f commit 0f596d8

File tree

1 file changed

+7
-1
lines changed
  • src/_DataStructures_/Trees/BinaryTree/check-binary-tree-subtree-another-binary-tree

1 file changed

+7
-1
lines changed

src/_DataStructures_/Trees/BinaryTree/check-binary-tree-subtree-another-binary-tree/index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
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+
17
function 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

0 commit comments

Comments
 (0)