Notes:??? Form R 1 of 7 Directions: For multiple choice (A, B, C, etc.), circle the letter of the best choice. For TRUE/FALSE, circle the word TRUE or the word FALSE. When a list of choices is given for a fill-in-the-blank, circle the word or phrase you feel most appropriately matches the surrounding sentence. Otherwise follow the directions given. I would prefer answers be left as an unevaluated formula than a giant number of any accuracy. I m not testing your ability to type into the calculator and copy the answer back off, after all, but rather your ability to use the correct formula(s) for the situation and fill in the main variables to get it started. Work easier problems first. Write out your plan for harder problems before beginning them. 1) Meg decides to throw her 10-year-old daughter Sue a birthday party and allows her to invite 15 friends to the house. Meg purchases 25 red balloons for the children, since red is Sue s favorite color. In how many ways can the balloons be distributed to the children at the birthday party (including Sue), assuming that no child should go home without a balloon? 2) An English professor has chosen five novels for a course in contemporary literature. Each student must choose to write an analysis of at least one of the novels. Extra credit will be given for every additional analysis. There are six students enrolled in the class. What is the number of ways the students can submit reports? 3) I have a bowl of identical candy bars. Four young trick-or-treaters have just knocked on my door and are holding their bags out for some candy. If I grab six candy bars from my bowl, in how many ways can I distribute all six of them? Give two answers: (a) I will try to be fair (b) I need not be fair. 4) The people in charge of a raffle are going to give out four prize bags to the raffle winners. They want to make sure that each prize bag contains at least one of the 11 gift certificates for a department store. In how many ways can the prize bags be prepared, assuming that all the gift certificates are of the same monetary value?
Notes:??? Form R 2 of 7 5) Use Theorem 7.22 on multiplying generating functions to find the coefficients of the following generating function. Simplify as far as possible. k k 8ÿ 8ÿ 3 k z 3 k z k 0 k 0 6) Use Newton s binomial theorem to expand the following into a power series: ˆ 1 3 1 4z 2 7) Mary made three dozen identical homemade chocolate chip cookies and is going to distribute them to four families in her neighborhood. Each family must receive at least six cookies. The Landers family cannot receive more than seven cookies because the mother does not want her family eating too many sweets. Mary also knows that there are many children in the Johnson family, so she wants to give them an ample supply of cookies. There are seven people in this family, and Mary wants to make sure that each family member gets at least two cookies. In how many ways can Mary distribute the chocolate chip cookies to the four neighborhood families? (Of course you should use generating functions in your solution strategy.)
8) Recall Example 7.4. Notes:??? Form R 3 of 7 i) Use pseudocode to write a recursive algorithm for calculating the sum of the first n non-negative integers. You may assume that n will never be less than 0. ii) Does this algorithm use tail-end recursion? (Shouldn t it?) iii) Use pseudocode to write a non-recursive algorithm for calculating the sum of the first n nonnegative integers. 9) Solve the following recurrence relation. (No, I don t want to know what all the numbers are, I want you to find a closed-form formula). a 0 7 and a n pn ` 1qa n 1, n ě 1
Notes:??? Form R 4 of 7 10) The following algorithm takes an unsorted list of positive integers, along with two integers x and y. It returns the largest number, z, in the list such that either z x y or z y x is true. It returns 0 if no such z exists. The algorithm assumes that the list size, n, is a power of 2 with n ě 1. 1 : integer xymax(x,y,ta 0, a 1,..., a n 1 u) 2 : if n == 1 3 : if (a x 0 == y) or (ay 0 == x) 4 : return a 0 5 : else 6 : return 0 7 : 8 : # process the left half 9 : 10 : m 1 = xymax(x,y,ta 0,..., a t n 2 u 1u) 11 : 12 : # process the right half 13 : 14 : m 2 = xymax(x,y,ta t n 2 u,..., a n 1 u) 15 : 16 : # find the largest 17 : 18 : max = m 1 19 : if m 2 ą max 20 : max = m 2 21 : 22 : return max 23 : end xymax i) What is the recurrence relation that counts the number of comparisons for this algorithm? (The critical steps are at lines 2, 3, and 19.) ii) What is a good big-θ reference function for algorithmxymax?
Notes:??? Form R 5 of 7 11) Find a closed-form formula for the following linear homogeneous recurrence relation with constant coefficients. Do not round off or use calculator approximations: use exact arithmetic! a 0 2, a 1 2, and a n 2a n 1 ` 15a n 2, n ě 2 Bonus Problems: 12) Repeat Quick Check 7.1 (page 338) but in line 14 ofsubsetsum, always choose the smallest element of W. i) Diagram of recursive invocations: ii) Which strategy (largest element as in the original Quick Check or smallest element as here) seems better? (Explain your answer.)
Notes:??? Form R 6 of 7 13) Find a closed-form formula for this following linear homogeneous recurrence relation with constant coefficients. Do not round off or use calculator approximations: use exact arithmetic! a 0 4, a 1 3, a 2 0, and a n 3a n 1 3a n 2 a n 3, n ě 3 14) A library has four identical display cases that are used to promote new acquisitions. This month, the librarians wish to promote nine books. They do not want any empty display cases. In how many ways can the books be displayed?
Notes:??? Form R 7 of 7 15) Find theθperformance of algorithms with the given recurrence relations. i) f p1q 11 and f pnq 2 f ` n 4 ` 1 log 4 4 pnq ii) f p1q 1 and f pnq f ` n 5 ` 2? n 16) Use a generating function approach to solve the following recurrence relation: a 0 2, a 1 2, and a n 2a n 1 ` 15a n 2, n ě 2