SENG1120 Assignment3-binary search tree and a hash table data structures to store strings Solved

35.00 $

Category: Tags: , , , , , , , , , ,
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (1 vote)

You are required to create a binary search tree and a hash table data structures to store strings that will function with the supplied TreeHashTableDemo.cpp and makefile. Both structures should have functions to add and remove elements, plus two overloaded operators: += and <<.

The classes MUST be implemented as class templates. As per the supplied makefile, the binary search tree class must be called BSTree and will use as nodes instances of BTNode. The hash table class must be named HTable. You will be provided with TreeHashTableDemo.cpp and makefile, and your classes need to interface with it.

The binary search tree contents must be printed using an inorder traversal. The hash table class must store the numbers in an array of size 150, and the contents can be printed from position 0 to n-1, but only for those positions that contain a valid entry. The hash function used must sum up the ASCII values of each character in the string and return the result of that sum mod (%) 150:

int hashfun(string value)

{

int addResult = 0;

// put you code here to add up the ASCII codes of all

// characters in the parameter value and store in the

// integer variable addResult     return addResult % 150; }

 

 

  • SENG1120A3-nyywar.zip