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
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..
Problem 2: In this problem we assume that h: U → {0, 1,..., m - 1} is a good hash function, that is, every key k has the same probability to map to any place in the table T of length m. 1 m (i) What is the probability that three pairwise distinct elements u₁, U2, U3 EU are mapped by the function h to the same place in the table (that is, h(u₁) = h(u₂) = h(uz))?
A hash map of size 12 has been constructed with Quadratic-Hashing by applying h(k) = (4ks +1 )mod 12. Perform Find(12) and mark in the hash-map below the cells which will be probed. Index 0 12 3 4 5 6 789 10 11 12 Value 3 44 36 11| 43
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education