Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(1) a) What is E, (3/4)*? b) What is the i i(3/4)'? (2) A coin has 1/4 chance of having heads, 3/4 chance of having
(1) a) What is E, (3/4)*? b) What is the i i(3/4)'? (2) A coin has 1/4 chance of having heads, 3/4 chance of having tails. It is tossed n times. a) What is the expected number of coin tosses needed to get a heads? b) What is the probability that the number of heads equals the number of tails? Write the expression using () notation, and then see if you can approximate what this gives. (3) If we change the randomized QUICKSORT algorithm so that it repeatedly ran- domly selects a pivot and runs PARTITION until it finds a good pivot like our SELECT does, and suppose we keep track of the pivots used so far so we never use one twice for the same array, what is the worst case cost of the algorithm? Give a recurrence for this and its asymptotic solution (you can use the master method.) (4) Suppose we have a table with 9 slots and use the hash function h(k) = k mod 9 where collisions are resolved by chaining. What does the table and chains look like after hashing 5, 28, 19, 15, 20, 33, 12, 17, 10. (5) Consider inserting the keys 10, 22, 31, 4, 15, 28, 17, 88, 59 into a hash table of length m = 11 using open addressing with the auxiliary hash function h'(k) = k. What are the results using a) linear probing; b)quadratic probing with e= 1 and d' = 3; c) double hashing with h1(k) = k and h2(k) = 1+ (k mod (m 1))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started