(no subject)


Subject: (no subject)
From: Matthew Cary (cary@cs.washington.edu)
Date: Mon Apr 15 2002 - 15:28:40 PDT


Be sure to read through tree.h in the course include directory. As in
real life, a lot of implementation details in this class are documented in
the source. Reading treesearch.C shows how the other methods are
implemented.

Remove() should not delete a node, only take it out of the tree. If you
have a tree that looks like

        5
       / \
      2 7
     / \
    1 4
       /
      3

And the node labled 2 gets it Remove() method called, it should
restructure the tree so that it looks like

        5 2
       / \
      3 7
     / \
    1 4

(I've written 2 over to the side to signify that the node still exists).

When it's done, Remove() should return the subtree rooted where the
removed node used to be, in this case, a pointer to 3.

Note that the tree has a Parent() method, which will make the
restructuring easier (in the example, 5->LChild() needs to be changed to
point to 3).

Your function is responsible for all tree restructuring. All Visualizer
bookkeeping is handled in the Set*Child() methods, there's nothing you
need to keep track of.

 
Matt

>
> I'm having trouble knowing what I am supposed to implement in Remove, I
> don't know who calls it and what book keeping stuff is implemented in the
> calling function.
>



This archive was generated by hypermail 2b25 : Mon Apr 15 2002 - 15:28:47 PDT