Homework 3
Question 1:
lower + upper case = 26 x 2 = 52
all characters = 52 + 10 + 1 = 63
Assuming that the minimum number of characters can be one, then:
Number of 1 character variables = 52 x 63 0
Number of 2 character variables = 52 x 63 1
Number of 3 character variables = 52 x 63 2
Number of 4 character variables = 52 x 63 3
Number of 5 character variables = 52 x 63 4
…
Number of 12 character variables = 52 x 63 11
Total = 3.27867 x 10 21
Question 2:
(a). There are 5! (= 120) anagrams
valid words are: aster, rates, stare,
(b). Allowing repeated letters should give more possibilities.
(c).
i.
Number of 1 character words = 5
Number of 2 character words = 5 x 4
Number of 3 character words = 5 x 4 x 3
Number of 4 character words = 5 x 4 x 3 x 2
Number of 5 character words = 5 x 4 x 3 x 2 x 1
Total = 325
Increase = (325 – 120) / 120 x 100% = 171 %
ii.
Total = 5 5 = 3125
increase = (3125 – 120) / 120 x 100% = 2504 %
Question 3:
(a). Total possible keys = 2 56 = 7.20576 x 10 16
(b). Total time = (7.20576 x 10 16 / (10 9 /sec x 3.154 x 10 7 sec/year) = 2.28464 years
(c). Total possible keys = 2 168 = 3.74144 x 10 50
Total time = (3.74144 x 10 50 / (10 9 /sec x 3.154 x 10 7 sec/year) = 1.18625 x 10 34 years
Question 4:
(a).
number of recipes with 0 mixins = 15
number of recipes with 1 mixins = 15 x (27! / 26!)
number of recipes with 2 mixins = 15 x (27! / 25!)
…
number of recipes with 26 mixins = 15 x (27! / 1!)
number of recipes with 27 mixins = 15 x 27!
Total = 4.43985 x 10 29
(b). Total with at least 2 = Total – num with 0 mixins – num with 1 mixin
≈ Total = 4.43985 x 10 29
Question 5:
x = number of bits needed
2 x >= 100,000
log 2 (2 x ) >= log 2 (100,000)
x >= log 2 (100,000) = 16.6
x = 17 bits
Question 6:
The 1st gentleman can sit with 10 possible ladies
The 2nd gentleman can sit with 9 possible ladies
…
The 9th gentleman can sit with 2 possible ladies
The 10th gentleman can sit with 1 possible ladies
Total possible pairs = 10! = 3628800
b.
The 1st lady can sit with 19 possible ladies
The 2nd lady can sit with 18 possible ladies
…
The 9th lady can sit with 11 possible ladies
The 10th lady can sit with 10 possible ladies
Total possible pairs = 19! / 9! = 3.352212864 x 10 11
Question 7:
(a).
Breakfast choices = 3
Lunch choices = 4
Dinner choices = 3
Total menus = 3 x 4 x 3 = 48
(b).
Breakfast splurge options = 1
Lunch splurge options = 2
Dinner splurge options = 1
Breakfast only options = 1 x (4-2) x (3-1)
Lunch only options = (3-1) x 2 x (3-1)
Dinner only options = (3-1) x (4-2) x 1
Total menus = 1x2x3 + 2x2x2 + 2x2x1 = 18
Question 8:
Assumptions:
Total number of core classes still needed = 17
Total number of core classes that prerequisites have been met = 13
Total number of elective classes still needed = 3
Total number of eligible elective classes = 9
(add one more option in 6th course for no course)
schedules with 1 electives = 9 x 13 x 12 x 11 x 10 x (9 + 1) = 1,544,400
schedules with 2 electives = 9 x 8 x 13 x 12 x 11 x (10 + 1) = 1,359,072
schedules with 3 electives = 9 x 8 x 7 x 13 x 12 x (11 + 1) = 943,488
Total = 3,846,960