Question: #include #include #define MINBIN 2 #define MAXBIN 20 double bin(int num_bin) { double result = 1.0; return result; } void main() { for (int num_bin=MINBIN;

 #include #include #define MINBIN 2 #define MAXBIN 20 double bin(int num_bin)

#include  #include  #define MINBIN 2 #define MAXBIN 20 double bin(int num_bin) { double result = 1.0; return result; } void main() { for (int num_bin=MINBIN; num_bin  Problem 3 [1 pt] This problem is related to CLRS Problem 5.4-3 (page 153). You toss balls into b bins until some bin contains two balls. Each toss is independent, and each ball is equally likely to end up in any bin. We want to determine the expected number of ball tosses by a recursive computation. Let T(k,b)= Expected number of tosses until some bin contains two balls given that that k bins are empty. Note that the expected number of ball tosses until some bin contains two balls equals T(0,b). (a) Write a recursion for T(k,b). Be sure to write the base case, and the recurrence for T( ). Note that the base case is when k=0. (b) Attached is a C program bin.c which displays the expected number of ball tosses for b=1,2,,30. The function double bin(int k, int b) doesn't work. Rewrite it so that it works and has time complexity O(b) and space complexity O(1) Note that bin( ) should be an iterative algorithm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!