(a)
To argue that numbers of ways of placing the balls in bins is
(a)
Explanation of Solution
Given information:
The n balls are distinct and their order within bin doesn’t matter.
Explanation:
There can be b different decisions made for n balls about their placement. The total number of possibilities is just
(b)
To prove that there are exactly
(b)
Explanation of Solution
Given information:
It is assumed that balls are distinct and that balls in each bin are ordered.
Explanation:
First assume that sticks can be distinguished. This implies that there are total of n balls and
This arrangement can be related with the original statement, where sticks can be imagined as dividing lines between bins and ordered balls between them can be imagined as ordered balls in each bin.
(c)
To show that
(c)
Explanation of Solution
Given information:
The balls are identical and their order within a bin does not matter.
Explanation:
Using results from above two parts, it can be noticed that any of the n permutation of balls will result in the similar configuration. Thus, count from the previous parts must be divided by
(d)
To show that number of ways of placing the balls is
(d)
Explanation of Solution
Given information:
The balls are identical and no bin may contain more than one ball.
Explanation:
Here, a set of bins to contain balls is selected,as each bin can have a ball or not. The numbers of bins selected is n since number of non-empty bins and the numbers of balls must be equal. In other words, a subset of size n of the bins is being selected from the whole set of bins. This becomes the combinatorial definition of
(e)
To show that number of ways of placing the balls is
(e)
Explanation of Solution
Given information:
The balls are identical and no bin may be left empty.
Explanation:
The condition is to put one ball in each bin as no bin can be left empty. Thus there are
Want to see more full solutions like this?
Chapter C Solutions
Introduction to Algorithms
- Assume we have two groups A and B of n cups each, where group A has n black cups while group B has n white cups. The cups in both groups have different shapes and hence a different amount of coffee per each cup. Given the following two facts: 1) All black cups hold different amounts of coffee, 2) Each black cup has a corresponding white cup that holds exactly the same amount of coffee, your task is to find a way to group the cups into pairs of black and white cups that hold the same amount of coffee. For example:arrow_forwardThis problem is taken from the delightful book "Problems for Mathematicians, Young and Old" by Paul R. Halmos. Suppose that 931 tennis players want to play an elimination tournament. That means: they pair up, at random, for each round; if the number of players before the round begins is odd, one of them, chosen at random, sits out that round. The winners of each round, and the odd one who sat it out (if there was an odd one), play in the next round, till, finally, there is only one winner, the champion. What is the total number of matches to be played altogether, in all the rounds of the tournament? Your answer: Hint: This is much simpler than you think. When you see the answer you will say "of course".arrow_forwardAssume we have two groups A and B of n cups each, where group A has n black cups while group B has n white cups. The cups in both groups have different shapes and hence a different amount of coffee per each cup. Given the following two facts: 1) All black cupshold different amounts of coffee, 2) Each black cup has a corresponding white cup that holds exactly the same amount of coffee, your task is to find a way to group the cups intopairs of black and white cups that hold the same amount of coffee.Input:A[15, 12, 13, 19, 14, 10, 16, 20, 9, 18, 8, 7] B[19, 14, 8, 16, 20, 9, 18, 15, 12, 13, 7, 10]Output:A[0] with B[7] A[1] with B[8] A[2] with B[9] A[3] with B[0]... and so onPage 3 of 5 a) Using a brute-force approach, design an algorithm to solve this problem, and analyze its complexityb) Design a more efficient algorithm to solve this problem,and analyze its complexity [Hint: you can use any data-structure]c) ImplementyourefficientalgorithmusingPythond) Prepare a brief report (250…arrow_forward
- Consider the following state for the 8-queens problem with heuristic h = number of pairs of queens that are attacking each other. What is the value of 'h' for the state obtained by moving the queen in the left-most column (circled) to the location marked X?arrow_forwardGiven a deck of 52 playing cards, we place all cards in random order face up next to each other. Then we put a chip on each card that has at least one neighbour with the same face value (e.g., on that has another queen next to it), we put a chip. Finally, we collect all chips that were each queen placed on the cards. For example, for the sequence of cards A♡, 54, A4, 10O, 10♡, 104, 94, 30, 3♡, Q4, 34 we receive 5 chips: One chip gets placed on each of the cards 100, 10♡, 104, 30, 3♡. (a) Let p5 be the probability that we receive a chip for the 5th card (i.e., the face value of the 5th card matches the face value of one of its two neighbours). Determine p5 (rounded to 2 decimal places). (b) Determine the expected number of chips we receive in total (rounded to 2 decimal places). (c) For the purpose of this question, you can assume that the expectation of part (b) is 6 or smaller. Assume that each chip is worth v dollars. Further, assume that as a result of this game we receive at least…arrow_forward业 In the 8 queens problem, you are to place 8 queens on the chessboard in such a way that no two queens attack each other. That is, there are no two queens on the same row, column, or diagonal. The picture above shows a near solution--the top left and bottom right queens attack each other. We want to solve this problem using the techniques of symbolic Al. First, we need states. What would the best choice be for states? Each queen and its position x Michigan, Illinois, Indiana, etc. How many queens we have placed so far A board with the positions of all the queens that have been placed so far 00 What would the start state be? A single queen's position Crouched, with fingers on the starting line Placing the first queen x An empty board What would the goal state be? CA board with 8 queens placed Ball in the back of the net The positions of all 8 queens A board with 8 queens placed, none attacking each otherv What would the best choice for "edges" or "moves" be? Tiktok Moving a queen from…arrow_forward
- Suppose a biking environment consists of n ≥ 3 landmarks,which are linked by bike route in a cyclical manner. That is, thereis a bike route between landmark 1 and 2, between landmark 2 and 3,and so on until we link landmark n back to landmark 1. In the centerof these is a mountain which has a bike route to every single landmark.Besides these, there are no other bike routes in the biking environment.You can think of the landmarks and the single mountain as nodes, andthe bike routes as edges, which altogether form a graph G. A path is asequence of bike routes.What is the number of paths of length 2 in the graph in termsof n?What is the number of cycles of length 3 in the graph in termsof n?What is the number of cycles in the graph in terms of n?arrow_forwardA certain cat shelter has devised a novel way of making prospective adopters choose their new pet. To remove pet owners’ biases regarding breed, age, or looks, they are led blindfolded into a room containing all the cats up for adoption and must bring home whichever they pick up. Suppose you are trying to adopt two cats, and the shelter contains a total of N cats in one of only two colors: black or orange. is it still possible to pick up two black cats with probability ½, given that there is an even number of orange cats in the room? If so, how many cats should be in the room? How many black, how many orange?arrow_forwardThe following problem is called the coupon collector problem and has many applications in computer science.Consider a bag that contains N different types of coupons (say coupons numbered 1 . . .N. There areinfinite number of each typ of coupon. Each time a coupon is drawn from the bag, it is independent of theprevious selection and equally likely to be any of the N types. Since there are infinite numbers of each type,one can view this as sampling with replacement. Let T denote the random variable that denotes the numberof coupons that needs to be collected until one obtains a complete set of atleast one of each type of coupon.Write a R simulation code to compute the E(T). Plot E(T) as for N = 10, 20, 30, 40, 50, 60. In the same plot show the theoretical value and summarize your observation regarding the accuracy of theapproximation.arrow_forward
- You are organizing a conference that has received n submitted papers. Your goal is to get people to review as many of them as possible. To do this, you have enlisted the help of k reviewers. Each reviewer i has a cost sij for writing a review for paper j. The strategy of each reviewer i is to select a subset of papers to write a review for. They can select any subset S; C {1,2, ..., n}, as long as the total cost to write all reviews is less than T (the time before the deadline): 2 Sij 1. (b) Show that for B = 2 this fraction is close to 1/3. [Hint: You can consider an instance with 3n + 1 papers and only n will be reviewed.]arrow_forwardA ancient magnate is failing. His want is to have solely ONE of his descendant’s receive ALL of his treasure, however which one? He has N quantity of decendants. He works out a answer to locate the one fortunate baby who inherits his wealth. He will get N tokens, label every token with an integer fee and assign every token to a descendant. Each token receives a cost solely once. He locations all the tokens in a circle round him, numbered 1 to N, and begins removing one in K till there is solely one left... Write a software that takes two integer values N and K and prints the token wide variety of the fortunate decendant. Input Format The first line of the entry includes the two integers N and K. Constraints . zeroarrow_forwardA mosaic is a matrix of nxn in which each cell is painted with some color. If we have n colors, we say that a mosaic is balanced if each color appears exactly once in each row and each column. For example, the following is a balanced mosaic of 4x4: Figure 1: Balanced mosaic of 4x4 Given a mosaic Mfrom n x n with some unpainted cells, we will say that Mit is colorable if there is a way to color the empty cells so that the resulting mosaic is balanced. Build a formula PEL (P)such that pit's satisfying + Mit is colorable and prove that your construction is correct.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education