
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Create a hash function and compute the index of a user using both the first and last names. (Simple hash function for strings)

Transcribed Image Text:1
#include <stdio.h>
2
#include <string.h>
3
#include <stdlib.h>
4
typedef struct {
char *fname;
7
char *lname;
8
} user_t;
9.
int hash_user(user_t u) {
// TODO: Create a hash function and compute the index of a user
// using both the first and last names.
10
11
12
13
14
15
}
16
17
int main() {
18
user_t user = {"Hilary", "Hahn"};
19
20
int index = hash_user(user);
21
22
printf("User hashed to %d\n", index);
23
24
return 0;
25
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- which index is also reffered to as a non-clustering index? a) Bidirectional Index b) Primary Index c) Hash Index d) Secondary Indexarrow_forwardThe following are applications of hash functions EXCEPT FOR Question 15 options: AES encryption algorithm Storing Passwords File synchronization Digital Signaturesarrow_forwardPlease solve thisarrow_forward
- What is a hash function?a) A function has allocated memory to keysb) A function that computes the location of the key in the arrayc) A function that creates an arrayd) A function that computes the location of the values in the arrayarrow_forwardA hash function is bi-directional, it allows us to create a fingerprint of a file and also reverse the processes to get the contents of the file Group of answer choices True Falsearrow_forwardWhich of the following is used in hash tables to determine the index of any input record?a) hash functionb) hash linked listc) hash treed) hash chainingarrow_forward
- What is the load factor?a) Average array sizeb) Average key sizec) Average chain lengthd) Average hash table lengtharrow_forwardWhich of the following operations are done in a hash table?a) Insert onlyb) Search onlyc) Insert and searchd) Replacearrow_forwardUse Python to program a hash with a couple of people and their interconnected birth years. Next, show the people's names and their birth years, and have the user enter one. Reverse the hash and show the birth years, having the user choose a birth year. Then, show the person's name for that birth year. Also, the user should have the option to add and delete entries.arrow_forward
- Hashing notes should be thorough. (Hashing, hash tables, collision, collision detection algorithms, temporal complexity, and hashing applications). Explain a hashing application. Do you have any recommendations for Java libraries?arrow_forwardData Structure & Algorithm: Suppose that an open-address hash table has a capacity of 600 and it contains 63 elements. What is the table's load factor? Are there any issues with these numbers? Discussarrow_forwardJava programming Computer science Please please help mearrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

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 Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

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
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY