CSC 216/s08/do right: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 14: Line 14:
     •If the node has one child, modify ______________?
     •If the node has one child, modify ______________?
     •If the node has two children, __________________?
     •If the node has two children, __________________?
There are several cases to be considered:
    * Deleting a leaf: Deleting a node with no children is easy, as we can simply remove it from the tree.
    * Deleting a node with one child: Delete it and replace it with its child.
    * Deleting a node with two children: Suppose the node to be deleted is called N. We replace the value of N with either its in-order successor (the left-most child of the right subtree) or the in-order predecessor (the right-most child of the left subtree).


===Participants and props===
===Participants and props===

Revision as of 02:30, 20 April 2008

Formatting Resources

Formatting Help Guide from MetaWiki

Learning how Binary Search Tree Works

The problem

Teaching the students how to insert and delete nodes from Binary Search Tree.
This includes:
How do we do insertion in a binary tree?
How do we delete a node from a binary search tree?

   •If the node is a leaf node, then _______________?
   •If the node has one child, modify ______________?
   •If the node has two children, __________________?

There are several cases to be considered:

   * Deleting a leaf: Deleting a node with no children is easy, as we can simply remove it from the tree.
   * Deleting a node with one child: Delete it and replace it with its child.
   * Deleting a node with two children: Suppose the node to be deleted is called N. We replace the value of N with either its in-order successor (the left-most child of the right subtree) or the in-order predecessor (the right-most child of the left subtree).

Participants and props

Students can do this on their individual computers or on in groups. Only thing that is needed from the users computer is flash loaded on it.

Flash link coming soon.

The script

Video animation, teaches students how to insert and delete from a binary search tree. Also has a built in game that allows players to insert and remove nodes from a binary search tree.