Determine if a binary tree is subtree of another binary tree using pre-order and in-order strings

前端 未结 6 908
被撕碎了的回忆
被撕碎了的回忆 2020-12-09 05:44

I want to find out whether binary tree T2 is a subtree of of binary tree T1. I read that one could build string representations for T2 and T1 using pre-order and in-

6条回答
  •  执笔经年
    2020-12-09 05:49

    Very interesting question. You seem to be correct. I suppose the issue that you mention arises due to different definitions of subtree in math (graph theory) and computer science. In graph theory T2 is a proper subtree of T1.

提交回复
热议问题