[Solved] CST8130 Lab 8-Hash Algorithm

$25

File Name: CST8130_Lab_8-Hash_Algorithm.zip
File Size: 263.76 KB

SKU: [Solved] CST8130 Lab 8-Hash Algorithm Category: Tag:
5/5 - (1 vote)

In this lab, we will write a program to handle inserts to a dynamically allocated array or ArrayList using a hash algorithm and a collision resolution algorithm. You can just write the code inside a method main to do the following;

  1. Declare a dynamically allocated array or ArrayList object called dataItems of 100 String

Think about both of these options what code needs to be in the constructor???

  1. Write a menu loop which allows these options
    • Add a String to the array dataItems
      • Prompt user to enter a String
      • use a hash algorithm to calculate the index of where to store the string in the dataItems array
      • the algorithm should be the first letter of the string to be added (converted to an int) added to the second letter of the input string if there is one (converted to an int) modulus 100 (so that you make sure the result is a number between 0 and 99.
      • if there is already a String in this index position move to the next sequential element position in the array until you find an empty location (but not past 99! in this case display error message String cannot be added)
    • search for a String in the array dataItems as efficiently as possible and display the index of where it is found or a message if it is not found
    • quit

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CST8130 Lab 8-Hash Algorithm
$25