4.8 You have two very large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of T1.
A tree T2 is a subtree of T1 if there exists a node n in T1 such that the subtree of n is identical to T2. That is, if you cut off the tree at node n, the two trees would be identical.
本文探讨了一种有效的算法来解决大型二叉树T1中是否存在小型二叉树T2作为其子树的问题。子树定义为T1中存在一节点n,使得n及其子节点构成的树与T2完全相同。此算法适用于处理大规模数据集,其中T1包含数百万个节点而T2则仅有数百个节点。

2879

被折叠的 条评论
为什么被折叠?



