我怎么能合并两个二叉树 [英] How i can merge two binary trees
问题描述
我有两个二叉树,我想将它们合并。 我的第一个问题是,我们是否可以合并两个二叉树,如果是如何有效,我可以进行合并操作,什么是不同的方式,我可以进行合并操作。 ..?
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 operations and what are the various ways i can perform the merging operations. ..?
推荐答案
不考虑效率,这个答案可能工作<一个href="http://stackoverflow.com/questions/4635141/algorithm-of-combining-two-binary-trees/4635146#4635146">Algorithm结合两个二叉树?。如果排序或平衡,在如何合并两个BST的效率?和<一href="http://stackoverflow.com/questions/2037212/concatenating-merging-joining-two-avl-trees">Concatenating/Merging/Joining 2 AVL树
Not considering efficiency this answer may work Algorithm of combining two binary trees? . If sorted or balanced, discussion on efficiency in how to merge two BST's efficiently? and Concatenating/Merging/Joining two AVL trees
这篇关于我怎么能合并两个二叉树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!