Algorithm of combining two binary trees?

前端 未结 3 1813
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-21 21:32

For example:

two trees :

       8                   9
   5        7          4       20
                    30

become one tre

3条回答
  •  不思量自难忘°
    2021-01-21 22:09

    Basic answer would be just to add all the elements in the smaller tree into the bigger tree.

    Another possiblity would be to look into B-Trees (self balancing trees)

提交回复
热议问题