Figuring a max repetitive sub-tree in an object tree
        Posted  
        
            by 
                bonomo
            
        on Programmers
        
        See other posts from Programmers
        
            or by bonomo
        
        
        
        Published on 2012-09-04T14:38:37Z
        Indexed on 
            2012/09/04
            15:52 UTC
        
        
        Read the original article
        Hit count: 420
        
algorithms
|trees
I am trying to solve a problem of finding a max repetitive sub-tree in an object tree.
By the object tree I mean a tree where each leaf and node has a name. Each leaf has a type and a value of that type associated with that leaf. Each node has a set of leaves / nodes in certain order.
Given an object tree that - we know - has a repetitive sub-tree in it.
By repetitive I mean 2 or more sub-trees that are similar in everything (names/types/order of sub-elements) but the values of leaves. No nodes/leaves can be shared between sub-trees.
Problem is to identify these sub-trees of the max height.
I know that the exhaustive search can do the trick. I am rather looking for more efficient approach.
© Programmers or respective owner