In linux system.
If I have two binary trees, tree A has millions of nodes, while tree B has only a few hundred nodes.
I want to check if B is a subtree of A.
One solution I am thinking is, say, A uses 50Mb of the memory, and the addresses are contiguous, while B uses 1Kb. If B is part of A, the addresses of B would be a subset of A's addresses (I guess?).
So can I use tree A’s memory address range and B’s memory address range to determine if B is a subtree of A?
UPDATE: I think if we are using static memory allocation, and there is one node that refers to the same pointer as the root of B refers to, probably when we find that node, we can determine B is a subtree of A.