Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
bartleby

Concept explainers

Question
Book Icon
Chapter 11, Problem 1P

(a)

Program Plan Intro

To determine the longest probe while performing insertion in hash table.

(a)

Expert Solution
Check Mark

Explanation of Solution

Given Information: The probability of ith insertion in hash table by using uniform hashing is atmost 2-k.

Explanation:

In the uniform hashing, where keys are inserted uniformly in available hashes. Suppose there is an open address hash table and keys are inserted one by one then average probe will be (1/(1-a)), where a is equals to load factor. So, while inserting keys into empty hash table, for the first hash slot, unsuccessful expected number of probe will be

  Pr{Xi}<=αi1 .

Since n<=m/2,α1/2 are given. Putting i=k+1 , in the given equation.

  Pr{Xk+1}(1/2)k+11

So, the at most probability will be Pr{Xk+1}=2k .

(b)

Program Plan Intro

Show that the ith insertion requires more than 2lg n probe and probability Pr{Xi>2lg n}  in the hash table of size m is = O(1/n2) .

(b)

Expert Solution
Check Mark

Explanation of Solution

Given Information: An open addressing hash table having size m and contains nm/2 items.

Explanation: From the above section, where the probability of ith insertion of an item in the hash table by using uniform hashing is at most 2-k.

Where k is the no. of probes. Now from the given condition, put the value of probe k is equals to 2 logn.

  =2 k=2 2lg n= ( 2lg n  ) 2=n 2=1/n2 

So, the complexity will be O(1/n2) .

(c)

Program Plan Intro

To show the asymptotic bounds for the probes required is equals to O(1/n) .

(c)

Expert Solution
Check Mark

Explanation of Solution

Given Information: For a particular event A, probability of probes required Pr{Ai}1/n2 .

Explanation: For an event A, required probes X>2lg n, and for the ith insertion, required probes for an event Ai, Xi>2log n . From the above explanation, probability of an event Ai for ith insertion is less than or equals to 1/n2.

An event Ai=A1A2A3A4An , where 1in

  Pr(A)Pr(A1)+Pr(A2)+Pr(A3)+Pr(A4)+.+Pr(An) ,

by Boole’s inequality

  n.1/n2=1/n

So, the asymptotic bound for the probe required is equals to O(1/n) .

(d)

Program Plan Intro

To determine the expected length of the longest probe sequence is O(lg n) .

(d)

Expert Solution
Check Mark

Explanation of Solution

Given Information: Probability of number of probes required Pr{X=k}, where k is equals to no. of probes.

Explanation:The expected length of the longest probe E[X] can be dependent on the given probability Pr{X=k} . To get the desired outcome, expected length E[X] can be divided in such a way that the total sum would not affected.

  E[X]=k.Pr{X=k}, 1k<n

Here,break the above equation into two parts by using some breaking point, in this case its 2lg n.

  E[X]=k.Pr{X=k} +k.Pr{X=k}, 1k<n

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
#. Consider a hash table of size 11 with hash function h(x) = x mod 11.Draw both hash tables (Closed-Bucket and Open-Bucket)  that results after inserting, in the given order, the following values: 45, 12, 35, 67, 25, 52, 88, 70, 68, 53, 55
Let S be the set consisting of all 10 digits and all upper- and lowercase letters. Let U be the set of all (ordered) strings consisting of exactly four elements from S. Construct an injective hash function h: U -> N with the smallest possible value of maxUh(u). Modify your hash function to give a simply uniform map h' to the set {0, ..., 30}. In other words, if U is a probability space with P(u) = P(u') for all u, u' in U, then the random variable h': U -> {0, ..., 30} should have a uniform distribution..
Suppose we use a hash function h to hash n distinct keys into an array T oflength m. Assuming simple uniform hashing, what is the expected number ofcollisions? More precisely, what is the expected cardinality of ffk; lg W k ¤ l andh.k/ D h.l/g?
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning