0% found this document useful (0 votes)
234 views

Computational Thinking Homework 5 Answers

The document provides examples and explanations of computational thinking concepts including: 1) A code-breaking problem involving analyzing letter frequencies and noticing patterns. 2) A logic puzzle involving placing names and ages in a grid using clues. 3) Explanations of divide and conquer algorithms like binary search and merge sort. 4) A magic squares problem and strategies for solving it, including that a brute force method would require trying 9! combinations.

Uploaded by

ravsking
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
234 views

Computational Thinking Homework 5 Answers

The document provides examples and explanations of computational thinking concepts including: 1) A code-breaking problem involving analyzing letter frequencies and noticing patterns. 2) A logic puzzle involving placing names and ages in a grid using clues. 3) Explanations of divide and conquer algorithms like binary search and merge sort. 4) A magic squares problem and strategies for solving it, including that a brute force method would require trying 9! combinations.

Uploaded by

ravsking
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Homework 5 Problem recognition

Unit 10 Computational thinking

Homework 5 Problem recognition 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.

For further puzzles, look at a site such as


http://www.brainbashers.com/showpuzzles.asp?
formpost=Y&field=ctop10a&page=1&puzzletext=A
(b) Write down two logical decision statements that helped you to find a solution. [2]
IF Miss Brown three years older than Mary THEN
Mary’s surname is not Brown
IF Brown is “Miss” THEN
Brian’s surname is not Brown
IF Brown is not Mary’s surname AND Brown is not Brian’s surname THEN
Brown is Anne’s surname
In general, where test data can be substituted for real data when developing the
system, real data does not need to be supplied. However, sometimes real data is
helpful in understanding the problem!
3. (a) Describe briefly an example of a “Divide and Conquer” algorithm. [2]
The binary search or merge sort are both examples of a divide and conquer approach.
(b) State any preconditions for devising the solution to this algorithm [1]
The preconditions for the binary search are that the items to be searched must be in
sequence
For the merge sort, there must be sufficient memory to hold all the items
(c) Why is this problem solving strategy generally so much more effective than a “brute
force” method of solving the problem? [1]
Because at each pass through the algorithm, the size of the problem is halved.
(d) Give two circumstances when a brute force method may be preferable to a “divide and
conquer” algorithm. [2]
If the preconditions are not satisfied, the “divide and conquer” algorithm cannot be
used.
If there are only a small number of items to be searched or sorted, a simpler algorithm
may be just as fast or at least fast enough.

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)

You might also like