{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw7 - EE608 Homework#7 11.1 —1 Suppose that a dynamic set...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EE608, Homework #7, 11.1 —1 Suppose that a dynamic set S 1s1epresented by a direct— address table T of length m Describe a procedure that ﬁnds the maximum element of S What 1s the worst— —case performance of your procedure? 11.1 .14 * We wish to implement a dictionary by using direct addressing on a huge array At the start the array entries may contain garbage, and initializing the entire array is impractical because of its size. Describe a scheme for implementing a direct- address dictionary on a huge array Each stored object should use 0(1) space; the operations SEARCH, INSERT, and DELETE should take 0(1) time each; and the initialization of the data structure should take 0(1) time (Hint. Use an additional stack, whose size is the number of keys actually stored 1n the dictionary, to help determine whether a given entry in the huge array is valid or not) 11.2-1 Suppose we use a hash function h to hash 11 distinct keys into an array T of length m. Assuming simple uniform hashing, what is the expected number of collisions? More precisely, what is the expected cardinality of {{k, l} : k :fé l and 171(k)? 11(1)}? 11.3-3 Consider a version of the division method in which h(k) = k mod m, where m = 21’ w l and k is a character string interpreted in radix 2P . Show that if string x can be derived from string y by permuting its characters, then x and y hash to the same value. Give an example of an application in which this property would be undesirable in a hash function. 11.3-5 * ‘ Deﬁne a family 36’ of hash functions from a ﬁnite set U to a ﬁnite set B to be e-universal if for all pairs of distinct elements k and l in U, Pr{h(k) = WM 5 6, where the probability is taken over the drawing of hash function h at random from the family Jé’. Show that an e-universal family of hash functions must have 11-] Longest-probe bound for hashing A hash table of size m is used to store 11 items, with n 5 m / 2. Open addressing is used for collision resolution. a. Assuming uniform hashing, show that for i = 1, 2, . . . , n, the probability that the ith insertion requires strictly more than k probes is at most 2‘1“. b. Show that for i = l, 2, . . . , n, the probability that the i th insertion requires more than 2lgn probes is at most 1/122. Let the random variable X ,- denote the number of probes required by the ith inser- tion. You have shown in part (b) that Pr {X ,~ > 21g 11} 5 1/112. Let the random variable X = maxlsisn X ,- denote the maximum number of probes required by any of the n insertions. c. Show that Pr{X > 21gn}51/n. d. Show that the expected length E [X] of the longest probe sequence is 0(lg n). 11~2 S lot-size bound for chaining Suppose that we have a hash table with n slots, with collisions resolved by chain- ing, and suppose that 11 keys are inserted into the table. Each key is equally likely to be hashed to each slot. Let M be the maximum number of keys in any slot after all the keys have been inserted. Your mission is to prove an 0 (lg n / lg lg n) upper bound on E [M], the expected value of M. a. Argue that the probability Q k that exactly k keys hash to a particular slot is given by Qk=<;:->"<1—:>"‘k<:>- b. Let Pk be the probability that M = k, that is, the probability that the slot containing the most keys contains k keys. Show that Pk f an. c. Use Stirling’s approximation, equation (3.17), to show that Q k < ek/ kk. d. Show that there exists a constant c > 1 such that Qko < 1 / n3 for k0 = clgn/lglgn. Conclude that Pk <1/n2 fork 2 k9 = clgn/lglgn. e. Argue that l l 1 E[M]£PrM>cgn ~n+PrM§an}-an. _ lglgn lglgn lglgn Conclude that E [M] = 0 (lg n/ lg lg n). ...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

hw7 - EE608 Homework#7 11.1 —1 Suppose that a dynamic set...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online