I am having two trees and I want to get the node from one tree and insert it into another tree. While inserting if the source node has more parents how to identify the path of the node and insert into the appropriate node in the destination tree.
How do you want to indicate what node to copy and where to move it to? What does "more parents" mean? That the node is more than 1 layer deep in the tree? Why does this matter? Are you trying to copy the node itself or the node and the path to it? Or do you need to insert the node at the same level in the new location?
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Aug 29, 2008
I need to insert the node at the same level in the new location.
Here I am giving the structure for more parents.
A -1 --2 ---leaf1 ---leaf2 B -1 --2 ---leaf1 ---leaf2 ---leaf3
I want to transfer the leaf nodes as if the left tree to the right tree.