CS 302 - Data Structures

Fall 2016

Programming Assignment 6: Binary Search Tree

Due on Tuesday, Nov 29 at 4 pm

Programming Problem 2 on Page 512. Remember that Chapter 16 provides details of how to implement binary search tree.

  1. Randomly generate 100 unique values in the range of [1-200] and insert them into a binary search tree (BST1). Print height and inorder output of the BST1 tree.
  2. Randomly generate 10 unique values in the range of [1-200] where there is an overlap with the previous values and insert them into another binary search tree (BST2). Print preorder, inorder, and postorder output of the BST2 tree.
  3. Find and remove any values of BST2 from BST1. Print height, number of nodes, and inorder output of the modified BST1 tree.
  4. Clear the binary search trees. Print whether trees are empty before and after clear operation.

Note: You can omit any operation that is not required for the above steps.

Bonus [1 points]: Run the algorithms with 100,000 values in the range of [1-100,000] in BST1.

Deliverables:

  1. Source code for your classes
  2. Doxygen reports for code documentation
  3. A main file that tests the classes with above steps.
  4. Test output of your codes.

Teaching Assistant:Shehryar Masaud

What to turn in: A softcopy of your sourcecode and reports should be uploaded to WebCampus. Compress all files as a single zip file.