Problem 1: Assume that you want to hash m-bit long strings (i.e. your universe i
ID: 3754925 • Letter: P
Question
Problem 1: Assume that you want to hash m-bit long strings (i.e. your universe is (o, 1]m with 2" elements) into a hash table with 2" slots (wiht mn). You can label each slot of the table with an n-bit string. So to hash an input x into a slot s we need a hash function that maps m-bit strings into n-bit strings. A possible way to do this is to consider a m × n binary matrix M and compute s = Mr mod 2 (where you think of r as an m-long column binary vector). Remember that arithmetic mod2 means that 1+1 0+0-0 and 1+0-0+1-1. Consider the family H of hash functions obtained by considering all possible such matrices M. Prove that this is a universal hash function family Hint: How many hash functions does H contains? In other words how many m x n binary matrices there are? Giten too distinct inputs 12 how many matrices map them to the same talue? In other trords how many matrices M have the property that Mz Mx2 Problem 2: In class we saw that resolving collisions by chaining would result in a constant-time insertion procedure, but potentially long deletion and search queries. We can consider an alternative way to store elements on a hash table which we call jumping around. In this system there are no collisions, because when we insert/delete/search an element we "jump around the table looking for it. More specifically: we define a hash function that takes as input an element z and a counter i . Insertion: When we insert z into the hash table we compute h(z, 0) and check if that slot is free. If it is not free we check h(z,1) and so on. So z is stored in location h(r,i) where i is the first counter Search: Similarly to search for z we compute h(z,i) in order until either we find a or we find an empty 1. Argue that Insertion and Search run in expected constant time if you assume simple uniform hashing. which yields a free slot. slot (which tells us thatis not in the table) 2. How you would implement deletion in this table? What can go wrong if you delete element r from the table and restore the slot as a "free" one in the table? What else can you do? Problem 3: In this problem we consider another alternative hashing technique which we will call Prush Shove. Here we have two hash functions hi and h2 which map elements to two different tables. The system works as follows: nd e hi(z) and store r in that location of the Insertion: When we insert z into the hash table we comput first table. This is easy if that slot is free. If it is not free we ”push" the element r, currentl there off the table and store it in the second table in location h2(). Again if that location is not free we take the element stored there and move it to the first table .continuing until we find a free where we don't have to push any other element off the tabl 1. Argue that Search and Dele tion can run in worst-case constant time using this system. hat can go wrong with the insertion procedure? If you identify the problem, think of possible ways to solve it.Explanation / Answer
Are you going to be a good time to LearN more about the same time as a result of the most important thing is that the only thing I can do it for the first time in the morning and and and and and and and and and and and I will be a good time to LearN more about the same time as a result of the most important thing is that the only thing I can do it for the the yyyyyyy the the the the the the the the the same trip to the next day and I have to go do not you you have are the only one of my those of the procedure the same as a a lot good lot good lot lot to do the it to you soon and