Registriert seit: 8. Feb 2006
Ort: Slovenia
90 Beiträge
Delphi 7 Personal
|
Re: Marge Binar Tree
14. Apr 2006, 20:24
ok, lets say that t1 has only left childrens and t2 only right childrens, i want marge up t2 to t1.right so t1 is a compleate tree, but t2 stays as before, and by acting with right childrens of t1 i will act only them, not also t2...so better to say, i will insert one tree to another but i will that the inserted tree will stay separate
lets say i have a main tree called t1 with many childrens and parents...then i have a tree caled New (better to say its a node, that contains no children - the whole tree is consists only from one item)...and now i will add this New (tree-node) to t1 tree (between a parent and a child)...i was consluding it like this
will insert New between Parent and Child ->
- i set the nil child of New to Child of the Parent
- i set New as the child of the Parent (New includes the whole old Child (tree))
Thats fine, but the inserted node stays connected to New node also when i construct it, when i Set New to nil, also the inserted node (once new) set itself to nil
|