Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Re: Re: Deleting a branch from a tree structure

by demerphq (Chancellor)
on Apr 23, 2003 at 17:24 UTC ( #252632=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Deleting a branch from a tree structure
in thread Deleting a branch from a tree structure

Hmm. If the child refrences the parent, then we can't delete the parent until we remove the childs reference to it, or remove the child itself of course. So we have to do a postorder traversal of the implicit tree. A preorder traversal as you have here would try to delete the parent while the children point at it.

Im assuming that the OP was using using the only sane way I know of to represent an nary tree in a single table form, that is using a parent pointer list representation. Now these may have been asumptions too far but... :-)


<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://252632]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2023-03-23 14:28 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.