Computational Thinking Homework 5 Answers
Computational Thinking Homework 5 Answers
1. In the film “The Imitation Game”, the code breakers tried different approaches to cracking
the German code, a transposition cipher in which each letter of the alphabet was replaced
by another letter.
(a) Using a “brute force” method, how many different permuations of letters would they
need to try, in the worst case scenario? Leave your answer in the form of a factorial.
(e.g. 4! = 4 x 3 x 2 x 1) [1]
26!
(b) Describe another strategy that could be tried rather than a brute force method to crack
the code. [3]
The code breakers could have tried (and probably did try) frequency analysis, looking
at which letters occurred most frequently in the message and guessing that they were
likely to be the letters most common in German text. e.g. in English, e and t are very
common.
They solved the problem eventually by noticing that the same letters often occurred at
the end of a message, and these equated to “Heil Hitler” which gave them several
letters. This helped them to guess other words and so on.
2. (a) There are three children whose first names are Anne, Brian and Mary. Their surnames
are Brown, Green and White, but not necessarily in that order. Given the following two
clues, find each child’s full name and age. [3]
Tip: Use the grid to help you. Place an x in each box which you know to be wrong, and
a in each box that you know to be right.
Clues
Brown
Green
White
1. Miss Brown is three years older than Mary.
7 9 10
2. The child whose surname is
White is 9 years old. Anne x x x x
Brian x x x x
Mary x x x x
7 x
9 x x
10
Answer:
Miss Brown (clue 1) cannot be Brian, who is a male. Place an X in the Brian/Brown
box. She cannot be Mary, so put an X in the Mary/Brown box. Miss Brown is therefore
Anne. Place a in that box and an X against other possible surnames for Anne.
Anne Brown is three years older than Mary (clue 1). She must be 10 and Mary, 7.
Place s in the Anne/10, Brown/10 and Mary/7 boxes. Place Xs in the empty boxes in
each row and column containing these s.
1
This study source was downloaded by 100000842402715 from CourseHero.com on 11-20-2023 16:42:22 GMT -06:00
https://www.coursehero.com/file/131992951/Computational-thinking-Homework-5-Answersdocx/
Homework 5 Problem recognition
Unit 10 Computational thinking
From the chart, you can now see that Brian’s age must be 9. Place a in the Brian/9
box.
Clue 2 states that White is 9, so he must be Brian. Place a in the White/9 box and
Brian/White box and an X in the other boxes in each row and column containing these
Xs.
The unfilled boxes must contain s, so Green must be the surname of 7-year-old
Mary.
2
This study source was downloaded by 100000842402715 from CourseHero.com on 11-20-2023 16:42:22 GMT -06:00
https://www.coursehero.com/file/131992951/Computational-thinking-Homework-5-Answersdocx/
Homework 5 Problem recognition
Unit 10 Computational thinking
4. A magic square with 3 rows and 3 columns is one which is filled with distinct integers
1-9 so that the sum of the numbers in each row, column and corner-to-corner diagonal are
the same. (Tip: The middle number is 5.)
8 3 4
1 5 9
6 7 2
(a) Using a brute force method, you would need to try up to 362,880 different
combinations of numbers. How is this number arrived at? [1]
It is 9! (Any of 9 numbers in the first square, 8 in the 2nd and so on.)
(b) Use another method to solve the problem. [2]
see above
(c) Describe your strategy. [2]
You need to work out what the sum of each row, column and diagonal has to be. The
answer is 15. The middle number has to be 5. After that, it’s trial and error.
20 marks
3
This study source was downloaded by 100000842402715 from CourseHero.com on 11-20-2023 16:42:22 GMT -06:00
https://www.coursehero.com/file/131992951/Computational-thinking-Homework-5-Answersdocx/
Powered by TCPDF (www.tcpdf.org)