Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network

  Advanced Search  

Binary Search Trees Page 1 Binary Search Trees

Summary: Binary Search Trees Page 1
Chapter 4
Binary Search Trees
o All keys are distinct why?
o Key in the root of the left subtree is less than the root.
o Key in the root of the right subtree is greater than the root.
o Left and right subtrees are binary search trees.
Figure 1 is an example:
Figure 1 Binary Search Tree
Where would you add X, B, and E?
At seats, build tree from the nodes: B R L M T C A N P D
What about deletion?
o Since it is easier to delete from a leaf, we first replace the node with its inorder
successor, and then delete the node that contained the inorder successor.
The code for insertion is as follows. I like to create the new node outside the insert
Binary Search Tree Class


Source: Allan, Vicki H. - Department of Computer Science, Utah State University


Collections: Computer Technologies and Information Sciences