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.

enter image description here enter image description here

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.

see hashing tree structure


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -