Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 7 additions & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /