How i can merge two binary trees

后端 未结 5 931
醉话见心
醉话见心 2020-12-18 03:39

I have two binary trees and I want to merge them. My first question is that whether we can merge two binary trees and if yes how efficiently I can perform the merge operati

5条回答
  •  自闭症患者
    2020-12-18 04:10

    1) Flatten both the trees in to sorted lists.
    2) Merge the lists from what you got in 1)
    3) Construct the tree out of what you got in 2)

提交回复
热议问题