Lab
Tree Traversals

Write a program that will allow you to enter at least ten letters of your name into a binary search tree (BST). Example: Anne Duvalier is entered as DUVALIERANNE, all uppercase. The program should then print out the contents of your BST using preorder, inorder, and postorder traversals, labeling each output by the proper traversal type. Recall the convention to place any duplicate letter in the left subtree of that letter. Use the following declarations.

  1. Write out your name input.
  2. Draw a picture of your BST.

    Use your tree to figure out each traversal:

  3. Preorder

  4. Inorder

  5. Postorder

  6. LevelByLevel (Challenge)

When your program's screen output matches your three traversals, get your program checked.


Continue to:  Unit 8 / Prev / Next