Is subTree
GO code
output
Is tree2 a subtree of tree1? true
Is tree3 a subtree of tree1? false
big-O time
O(A+B)
A : the number of nodes in the main tree
B : the number of nodes in the sub tree
Is tree2 a subtree of tree1? true
Is tree3 a subtree of tree1? false
O(A+B)
A : the number of nodes in the main tree
B : the number of nodes in the sub tree