Presentation is loading. Please wait.

Presentation is loading. Please wait.

BITS Pilani Pilani Campus Discrete Structures for Computer Science Section – 3 - Tutorial – 2 (21 Aug 2013) Jagat Sesh Challa.

Similar presentations


Presentation on theme: "BITS Pilani Pilani Campus Discrete Structures for Computer Science Section – 3 - Tutorial – 2 (21 Aug 2013) Jagat Sesh Challa."— Presentation transcript:

1 BITS Pilani Pilani Campus Discrete Structures for Computer Science Section – 3 - Tutorial – 2 (21 Aug 2013) Jagat Sesh Challa

2 BITS Pilani, Pilani Campus Problem - 1

3 BITS Pilani, Pilani Campus Problem - 2

4 BITS Pilani, Pilani Campus Problem - 3

5 BITS Pilani, Pilani Campus Problem – 4

6 BITS Pilani, Pilani Campus Problem – 4

7 BITS Pilani, Pilani Campus Problem – 4

8 BITS Pilani, Pilani Campus How many ways can I select 15 cans of soda from a cooler containing large quantities of Coke, Pepsi, Diet Coke, Root Beer and Sprite? We have to model this problem using the chart: Here, we set an order of the categories and just count how many from each category are chosen. Problem - 5 CokePepsiDiet Coke Root Beer Sprite A111 15 B11111111 115 C11111111111111115

9 BITS Pilani, Pilani Campus Now, each event will contain fifteen 1’s, but we need to indicate where we transition from one category to the next. If we use 0 to mark our transitions, then the events become: A: 1110111011101110111 B: 1100111111011111101 C: 0111101111111011110 Thus, associated with each event is a binary string with #1’s = #things to be chosen and #0’s = #transitions between categories. Problem - 5

10 BITS Pilani, Pilani Campus From this example we see that the number of ways to select 15 sodas from a collection of 5 types of soda is C(15 + 4,15) = C(19,15) = C(19,4). Note that #zeros = #transitions = #categories - 1. Theorem: The number of ways to fill r slots from n categories with repetition allowed is: C(r + n - 1, r) = C(r + n - 1, n - 1). In words, the counts are: C(#slots + #transitions, #slots) or C(#slots + #transitions, #transitions). Problem - 5

11 BITS Pilani, Pilani Campus How many ways can I fill a box holding 100 pieces of candy from 30 different types of candy? Solution: Here #slots = 100, #transitions = 30 - 1, so there are C(100+29,100) = 129!/(100!29!) different ways to fill the box. How many ways if I must have at least 1 piece of each type? Solution: Now, we are reducing the #slots to choose over to (100 - 30) slots, so there are C(70+29,70) = 99!/70!29! Problem - 5.1& 5.2

12 BITS Pilani, Pilani Campus Problem - 6

13 BITS Pilani, Pilani Campus Problem - 7

14 BITS Pilani, Pilani Campus Problem - 7

15 BITS Pilani, Pilani Campus Problem - 8

16 BITS Pilani, Pilani Campus Generate next and previous 10 permutations of 124653. Next 10 permutations - 124653 -> 125346 -> 125364 -> 125436 -> 125463 -> 125634 -> 125643 -> 126345 -> 126354 -> 126435 Previous 10 permutations – 124653 -> 124635 -> 124563 -> 124536 -> 124365 -> 124356 -> 123654 -> 123645 -> 123564 -> 123546 Problem - 9

17 BITS Pilani, Pilani Campus Problem - 10

18 BITS Pilani, Pilani Campus Problem – 11

19 BITS Pilani, Pilani Campus Problem -11

20 BITS Pilani, Pilani Campus Tri-mino Problem Best explained on the Board…!!! Problem - 12

21 BITS Pilani, Pilani Campus


Download ppt "BITS Pilani Pilani Campus Discrete Structures for Computer Science Section – 3 - Tutorial – 2 (21 Aug 2013) Jagat Sesh Challa."

Similar presentations


Ads by Google