Binary Trees question. Checking for similar shape

后端 未结 5 618
刺人心
刺人心 2021-01-06 06:49

Hi I\'m stuck doing this, not sure how to go about it.

If I have two binary trees, how would I check if the have the same shape? Data in the nodes doesn\'t matter, j

5条回答
  •  猫巷女王i
    2021-01-06 07:36

    Walk them in pre-order and in-order with symbolic names instead of the actual data and compare the resulting Strings. Maybe some more input on your data structure would be usefull.

    Not java related AFAICT

提交回复
热议问题