You will write using hash tables of a Map data structure. Write the code by following the steps below: 1. Store char * (name) as key and int (number of courses taken) as value in your map. Let the hash function you use use an algorithm you specify when converting the name into an index. 2. Let the put function add the given name and the number of lessons taken to the map. If the name (key) exists on the map, replace this existing name and the number of courses taken with a new one. That is, only one unique key can be found on the map at a time. 3. The contains function checks whether the key (name) sent to it is on the map. Send 1 if available, 0 otherwise. 4. Let the Get function send the number of lessons learned for the most sent key. If the key is not present in the map, it returns -1. 5. The display function displays all key-value pairs of the map print it. 6. Search for free space linearly in case of collision. You have to solve the question using all functions.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

You will write using hash tables of a Map data structure. Write the code by following the steps below:

1. Store char * (name) as key and int (number of courses taken) as value in your map. Let the hash function you use use an algorithm you specify when converting the name into an index.

2. Let the put function add the given name and the number of lessons taken to the map. If the name (key) exists on the map, replace this existing name and the number of courses taken with a new one. That is, only one unique key can be found on the map at a time.

3. The contains function checks whether the key (name) sent to it is on the map. Send 1 if available, 0 otherwise.

4. Let the Get function send the number of lessons learned for the most sent key. If the key is not present in the map, it returns -1.

5. The display function displays all key-value pairs of the map print it.

6. Search for free space linearly in case of collision.

You have to solve the question using all functions.

Write the code in C programming language using all of the above functions? (C++ not accepted)

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY