Question

Lab assignment

Write a program that creates a Hash Table to store the data in the provided file which is a list of colors, ColorList.txt, as defined below:


Create a Hash table with 15 bins

  • Use a basic hashing algorithm that adds the ASCII values of each letter in the color name and then mods by your chosen number of bins.

  • Place the color in the appropriate bin where the contents of each bin is a linked list (so you can hold any number of items in any one bin)

Once you've created the Hash table of colors, have your program do the following:


Report out the:

  • Average number of colors stored in each bin ignoring any bins that have 0 entries

  • Maximum number of colors in any one bin

Write a loop that continues until the user says stop that:

Asks the user to search for a color

  • If found, ignoring the case, report which bin it was found in (Make sure your code ONLY searches the appropriate bin)

  • If not found, add the color to the Hash Table

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Lab assignment
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • C++ Based upon the information provided on Hashing and Hash tables, create a Hash Table to...

    C++ Based upon the information provided on Hashing and Hash tables, create a Hash Table to store the data in the provided file which is a list of colors,ColorList.txt Using the basic algorithm that adds the ASCII values of each letter in the color and then mods by your chosen number of bins. Determine the best size (number of bins) for your hash table that is close to Balanced with an average list length between 12-15 (NOTE: list lengths of...

  • in C++ Code should work for all cases In this assignment you are requested to implement...

    in C++ Code should work for all cases In this assignment you are requested to implement insert, search, and delete operations for an open-addressing hash table with double hashing. Create an empty hash table of size m= 13. Each integer of the input will be a key that you should insert into the hash table. Use the double hashing function h{k, i) = (hı(k) + ih2(k)) mod 13 where hi(k)= k mod 13 and h2(k) = 1+(k mod 11). The...

  • Implement a software program in C++ t stores and searches the Student records using double-hashing algorithm.  Double...

    Implement a software program in C++ t stores and searches the Student records using double-hashing algorithm.  Double hashing uses the idea of applying a second hash function to key when a collision occurs.   The software program will be based on the following requirements: Development Environment: If the software program is written in C++, its project must be created using Microsoft Visual Studio 2017. If the software program is written in Java, its project must be created using NetBeans v8.2. Algorithm: If...

  • Insert elements into a hash table implemented using chain hashing, as an array of linked list...

    Insert elements into a hash table implemented using chain hashing, as an array of linked list in which each entry slot is as a linked list of key/value pairings that have the same hash (outcome value computed using certain hash function). You are allowed to use “Hash Function”, h(k) = k % x where, x is the value you will need to decide to use, that you find appropriate for this implementation. The main requirements are the following: 1. Input:...

  • THIS IS IN THE JAVA SCRIPT CODE ALSO PLEASE SEND ME THE CODE TYPED THANK YOU....

    THIS IS IN THE JAVA SCRIPT CODE ALSO PLEASE SEND ME THE CODE TYPED THANK YOU. Program 1 Write an inheritance hierarchy of three-dimensional shapes. Make a top-level shape interface that has methods for getting information such as the volume and the surface area of a three-dimensional shape. Then make classes and subclasses that implement various shapes such as cube, cylinders and spheres. Place common behavior in superclasses whenever possible, and use abstract classes as appropriate. Add methods to the...

  • Please answer this problem in C++, Thank you! Read and study the sample program: "hashing with chaining using singly...

    Please answer this problem in C++, Thank you! Read and study the sample program: "hashing with chaining using singly linked lists", as well as "hashing with chaining using doubly linked lists". Notice this program is complete except it doesn't include the remove function. Write the remove function and test it with the rest of the program including the given main program. Upload your C++ source file. ---Here is the referenced program: "hashing with chaining using singly linked lists". Below this...

  • CAN SOMEONE PLEASE HELP ME WRITE THIS CODE IN C++, PLEASE HAVE COMMENTS IN THE CODE...

    CAN SOMEONE PLEASE HELP ME WRITE THIS CODE IN C++, PLEASE HAVE COMMENTS IN THE CODE IF POSSIBLE!! General Description: Write a program that allows the user to enter data on their friends list. The list holds a maximum of 10 friends, but may have fewer. Each friend has a name, phone number, and email address. The program first asks the user to enter the number of friends (1-10). You are not required to validate the entry, but you may...

  • in c++ please Write a program in c+ to do the following: 1.Save the data shown...

    in c++ please Write a program in c+ to do the following: 1.Save the data shown below (in the same format) to make a text file called "InputData. txt"; use the file as input to enter data into a hash table. Fname Lname 2019-01-31 First Last 2018-02-01 Jonh Doe 2017-03-28 Jane Doe 2016-04-01 as the data items in the file 2. Your hash table should have as many entries 3. The birthday should be used as the hash key by...

  • please solve the Program USING MATLAB. do not do #2. write in details for the command...

    please solve the Program USING MATLAB. do not do #2. write in details for the command lines. Make sure the program runs and also completely does what it askes please Write a Matlab program that displays on the screen checkerboard patterns comprising of two alternating_colors to be selected by the user. Your program MUST use as the checkerboard unit pattern a SQUARE INSCRIBED INSIDE A CIRCLE with unit pattern width and checkerboard dimension also to be inputted by the user....

  • Task: Comparing the performance between Linear Probing and Double Hashing. Requirements: Please make sure your program...

    Task: Comparing the performance between Linear Probing and Double Hashing. Requirements: Please make sure your program compiles, otherwise your submission will not be graded and you will receive zero. Point deduction rule: Compile warning: 3 points each. Minor error: such as not meeting the assignment input/output requirement, 5 points each. Major error: examples include, infinite loop, runtime errors, any runtime exception, 15 points each. Any code not compliant to the assignment requirement (e.g., not using List interface and AbstractMap and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT