Visualizing Permutation-Combination Problem Using JavaScript
1 - Permutation and Combination
Ques: Find the number of ways of distributing 8 identical balls in 3 distinct boxes so that none of the boxes
is empty.
Ans: Let the number of balls in three boxes be X, Y and Z.
Below, the rounded corner rectangles are representations of boxes.
We see that X + Y + Z = 8 with X, Y, Z >= 1 and <=6.
If we put two sticks between 8 balls, is it an equivalent representation of the above scenario?
The order (which stick you put first and which you put second) in which you select those two gaps is not important. And when the order is not important, it gives rise to "Combination". So from the above diagram, there are only 7C2 ways of doing it, that is the number of ways you can put two sticks in any of the seven gaps
between the eight balls.
You can play around with this experiment by clicking the green button.
Tags: Technology,Mathematical Foundations for Data Science,JavaScript,Web Development,
No comments:
Post a Comment