Starting from:

$25

CSD235335 - Assignment 5 - Solved

    Programming  - Hash Tables and Binary Search Trees


 

Hash Tables and Binary Search Trees
In the last programming assignment you were to implement a hash table that resolved collisions with chaining. Each non-empty bucket in the hash table array contained a reference to a Java

LinkedList<Integer> obect. As collisions were encountered, items that collided were added to a linked list referred to by the bucket the item hashed to.

For this assignment, each non-empty bucket in the bucket list will hold a reference to a Binary Search Tree. You are to implement the Binary Search Tree from the pseudo code provided in chapter 6 of the zybook for this course

The hash table must meet the following requirements:

  the underlying data structure, hashArray, is a fixed size Java array (not an ArrayList) of type BinarySearchTree

 The data field for the Node in the BinarySearchTree must be of type Integer

When an item is added to an empty bucket, instantiate a BinarySearchTree and store a reference to it in the bucket   when the loading factor reaches 1.0, resize hashArray to the next prime number greater than twice the hash Array's current size, and then rehash

 

methods:

 HashTable( int sz )  //a constructor that takes a single int parameter void insert(Integer key)  //takes an Integer parameter and stores it in the list void remove(Integer key)  // find an item in the hash table and remove it

Integer search(Integer key)  // searches for an item in the hash table and if found, return it.

Otherwise, return null

  String toString()  // outputs the contents of the hash table, one row per element in hashArray

https://lwtech.instructure.com/courses/1940982/assignments/18954223?module_item_id=43888917                                                                          


More products