CIS 22C De Anza College Binary Search Trees Lab 5 & 6 Reports

User Generated

Urael2020

Computer Science

CIS 22C

De Anza College

CIS

Description

Using C++

Lab 5 - Binary Search Trees

  • Declare and implement a BSTNode ADT with a data attribute and two pointer attributes, one for the left child and the other for the right child. Implement the usual getters/setters for these attributes.
  • Declare and implement a BST as a link-based ADT whose data will be Currency objects - the data will be inserted based on the actual money value of your Currency objects as a combination of the whole value and fractional value attributes.
  • For the BST, implement the four traversal methods as well as methods for the usual search, insert, delete, print, count, isEmpty, empty operations and any other needed.
  • Your pgm will have at least 10 Currency objects created from data in an input text file - one per line in the right form as for Lab 1A.
  • Also, create an output file to write program output as specified in one or more instructions below.
  • The data files can be anywhere on the machine, so prompt the user for the full path of the file.
  • Perform adequate data validation when reading data from the file - if any data item is invalid, ignore the data item and continue to next item but print a message to output (both screen and output file ) to indicate which data items were ignored.
  • Read the data to create your Currency database using the BST.
  • Provide interactivity for the user to add/search/delete nodes from the console after the data has been seeded into the application.
  • Once the user selects the option to print data or exits the program, the data in the BST should be printed out to both screen and output file in all four traversal methods in the specific sequence of breadth-first, in-order, pre-order, post-order.
  • Ensure I can run the programs by using my own input file without having to fix your code for file locations - the file name and location is unknown to you.

Lab 6 Makeup - Hash Tables

Write a program to do the following:

  1. Use the input data file you provided for Lab 5 (your BST homework) as input to enter data into a hash table.
  2. Declare a hash table of size 29 elements.
  3. To hash your currency objects into the hash table, use the pseudorandom hash scheme - (m*w + n*f) % size - where size = 29, m = 2, n = 3, w = whole value, f = fractional value.
  4. For collision resolution, use quadratic probing in the same direction always. Remember to circle around to the start of the array if needed.
  5. Your main will first load the data file into the hash table and print the number of data items loaded, load factor and number of collisions.
  6. Then it will ask the user in a loop to enter a Currency to search for. If the Currency object is found in the hash table, it will print the index where found, otherwise it will print 'Invalid Data'. Then it will ask the user if they want to check again or end the program.
  7. I will test your program with my own version of the data file which may exist in any folder on my machine and the number of entries in the file are unknown to you when coding.

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

At...


Anonymous
Very useful material for studying!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Content

Related Tags