How to check if a non binary tree is a subtree of another -
i'm working trees , need know how check if if non binary tree subtree of another.
these trees have n nodes , n levels, , children's order not important. know if tree subtree of another
the problem me how recursion , compare both tree @ same time recursion.
for create exemple demonstrate want do.
i know roots of both tree , i;m trying in ruby on rails, know justa want know pseudo code or logic.
someone can me?
thanks
i try use ideas hash tree or merkle tree:
a hash tree or merkle tree tree in every non-leaf node labelled hash of labels of children nodes. hash trees useful because allow efficient , secure verification of contents of large data structures.
Comments
Post a Comment