1 o6 d* ~9 u2 K/ ^is it? the pre-order sequences of the above trees are [1, 2, 4, 3, 5] and [6, 2, 4, 3, 5] respectively, and the in-order sequences are [4, 2, 1, 3, 5] and [4, 2, 6, 3, 5] respectively, how can you separate them into two trees?- H7 o" K& @- O V" n
actually, you cannot ask for the common substring, it may be common subsequence, think about the two trees, [1, 2, 3, 4, 6, #, 5, #, #, 8, #, #, #, #, #] and [1, 2, 3, 4, 6, #, 5, 7, #, #, #, #, #, #, #], there are no common strings of both the pre-order sequences and in-order sequences, but [2, 4, 6] is the required common substructure. |