A tree subRoot is a subtree of root if some node in root starts an identical tree.
Traverse root. At each node, run a sameTree check against subRoot. If any match, return true.
Every possible subtree root in root is examined; equality check ensures exact structural/value match.
A tree subRoot is a subtree of root if some node in root starts an identical tree.
Traverse root. At each node, run a sameTree check against subRoot. If any match, return true.
Every possible subtree root in root is examined; equality check ensures exact structural/value match.