Question: PYTHON Consider the following two hash functions. Let U be the universe of strings composed of the characters from the alphabet , and let then
PYTHON
Consider the following two hash functions. Let U be the universe of strings composed of the characters from the alphabet
, and let then function
return the index of a letter
, e.g., f(a) = 1 and f(Z) = 26. Finally, for an m-character string
^ m, define
, where
is the number of buckets in the hash table. For the other hash function, let the function
return
, where
is a uniform random integer,
, and define
. That is, the first hash function sumps up the index values of the characters of a string x and maps that value onto one of the
bucket, and the second hash function is a universal hash function.
(a) Using the txt file (below) that contains US Census derived last names (or just any list of names) as input strings, first choose a uniformly random 50% of these name strings and then hash them using h1(x) and h2(x).
SMITH
JOHNSON
WILLIAMS
JONES
BROWN
DAVIS
MILLER
WILSON
MOORE
TAYLOR
ANDERSON
THOMAS
JACKSON
WHITE
HARRIS
MARTIN
THOMPSON
GARCIA
MARTINEZ
ROBINSON
CLARK
RODRIGUEZ
LEWIS
LEE
WALKER
HALL
ALLEN
YOUNG
HERNANDEZ
KING
WRIGHT
LOPEZ
HILL
SCOTT
GREEN
ADAMS
BAKER
GONZALEZ
NELSON
CARTER
MITCHELL
PEREZ
ROBERTS
TURNER
PHILLIPS
CAMPBELL
PARKER
EVANS
EDWARDS
COLLINS
STEWART
SANCHEZ
MORRIS
ROGERS
REED
COOK
MORGAN
BELL
MURPHY
BAILEY
RIVERA
COOPER
RICHARDSON
= [A, ....., Z]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
