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
Hey, Given is a hash table with an initial size of 1000 and a hash function that ensures ahashing, where the keys are chosen randomly under the uniformity assumption.me are chosen. After how many insertions do you have to expect a collision probability of more than 80%?of more than 80%?To keep the number of collisions low during hashing, one can reduce the size of the has-hash table after a certain number of insertions. After which number n of inserted elements must the table be increased for the first time, if no collision occurred in the previous n - 1 elements and the probability of a collision in the n-th insertion should be less than 20%?
Consider a hash table of size m = 8 with hash function h(k) = (3k+2) mod m. Draw the tablethat results after inserting, in the given order, the following values: 13, 49, 33, 26, 38, 87, 26,67 Handle collisions by linear probing.
Consider a CBHT (closed bucket hash table) in which the keys are student identifiers. Assume that the number of buckets m = 100 and hash function hash (id) = first two digits of id. #Starting with an empty hash table, show the effect of successively adding the following student identifiers: 000014, 990021, 990019, 970036, 000015, 970012, and 970023. Show the effect of deleting 000014 from the hash table.
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