Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 . ( 5 points ) Suppose we have a hash table of size 2 9 and we want to implement a system for looking

2.(5 points) Suppose we have a hash table of size 29 and we want to implement a system for looking
up a friends information given his/her name. Which of the following hash functions is the best?
Justify your choice. (Assuming none of the names is empty.) Short Answer and Letter choice
(a) h(x)= x
(b) h(x)= n %13,where n is the number of characters in x
(c) h(x)=(ord(x[0])+ ord(x[1]))%29, where x[0] is the first character in the name and x[1]
is the last.
(d) h(x)=29
n
(e) h(x)=
i=0
ord(x[i]), where n is the number of characters in x, x[i] the ith character in x,
and ord(c) returns the ordinal value of a character. (Instruction on the \Sigma summation symbol

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions