Documente Academic
Documente Profesional
Documente Cultură
Adapted for classroom use by Robyn Adams and Jane McKenzie Illustrated by Matt Powell
Parents Edition by Andrea Arpaci-Dusseau Solutions
Computer Science Unplugged: Parents Edition2007Version 1
Solutions
Activity 1: Binary Numbers ..........................................................................................1 Activity 2: Representing Bits.........................................................................................3 Activity 3: Representing Letters....................................................................................4 Activity 4: Representing Pictures..................................................................................5 Activity 5: Compressing Text........................................................................................7 Activity 6: Detecting Errors ..........................................................................................9 Activity 7: Detecting More Errors...............................................................................10 Activity 8: Information Theory...................................................................................11 Activity 9: Searching ..................................................................................................12 Activity 10: Sorting.....................................................................................................13 Activity 11: Faster Sorting..........................................................................................14 Activity 12: Sorting Networks .....................................................................................15 Activity 13: The Muddy City .......................................................................................17 Activity 14: Routing and Deadlock.............................................................................19 Activity 15: Finite-State Automata .............................................................................20 Activity 16: FSA Representation.................................................................................22 Activity 17: Programming Languages........................................................................24
Version 1
b) c) d) e) f) g) h) i)
j)
k) l) m) n) o)
p) q) r) s) t) u)
Version 1
10001 = 16 + 1 = 17. 1+2 = 3. 1 + 2 + 4 = 7. 1 + 2 + 4 + 8 = 15 1+2+4+8+16 = 31. The sum of the previous cards is always equal to the next higher card. 010, or 2, changes to 0100, or 4. 101, or 5, changes to 1010, or 10 in decimal. 110, or 6, changes to 1100, or 12 in decimal. A binary number is multiplied by two when a zero is shifted into the right-most digit.
Activity 1 Worksheet 1
What is 00110 (as a shortcut, this can be written 110)? 6 What is 01100 (as a shortcut, this can be written 1100)? 12 What is 10101? 21 What is 11111? 31 What is 8? 01000 What is 3? 00011 What is 17? 10001 What is 30? 11110 What is 14? 01110
Version 1
Version 1
Version 1
Version 1
Version 1
b)
c)
Original poem first line: 8 Second: 13 Third: 13 Fourth: 18 Fifth: 13 Sixth: 13 Seventh: 18 Total: 96 letters and spaces Compressed poem first line: 8 Second: 9 Third: 0 Fourth: 10 Fifth: 0 Sixth: 0
d)
Version 1
Seventh: 14 Total: 41 e) f) g) h) i) j) The compressed poem is 51/96 the size of the original, which is a little more than half the size. Or, you could say it has 96-51=45 fewer letters and spaces. The compressed poem is 41/96 the size of the original, which is a little less than half the size. Or, you could say it has 96-41 = 55 fewer letters and spaces. 5 arrows 5 arrows * 2 characters/arrow = 10 characters 41+10 = 51.
Pease porridge hot, Pease porridge cold, Pease porridge in the pot, Nine days old. Some like it hot, Some like it cold, Some like it in the pot, Nine days old.
Version 1
b)
c)
d) e) f) g)
h) i) j)
Version 1
d) e) f) g) h) i)
Version 1
10
b)
c)
f) g) h) i)
Version 1
11
Activity 9: Searching
a) b) c) d) e) f) g) h) i) j) k) l) m) n) o) Answers will vary. Answers will vary. Best possible score is 1 guess. Worst possible score is 25 guesses. Requires 25 guesses if secret ship is not there. Usually need to look at about half the ships, or about 12 guesses. About half the ships, or 50 guesses. Answers will vary. Answers will vary. Best possible score is 1 guess. The worst possible, if using the binary search correctly on 25 ships, is 5 guesses. Still takes 5 guesses. It will usually take about half of the possible ships, or 2 or 3 guesses.
Figure out the bucket of the students secret ship out loud. Have the student figure out in which bucket your secret ship is located.
Answers will vary. Best possible is 1 guess. Worst possible is the number of ships in a given bucket. If all of the ships were in the same bucket, the game becomes the same as the linear search with completely secret ships. Would have to search through all of the ships in the bucket. With 25 ships and 10 buckets, there should be about 2.5 ships per bucket. We should then find the ship in 1 or 2 guesses. Pick the bucket with the most ships in it. The bucket with the fewest ships.? The only advantage of linear searching is that it doesnt require that the ships are organized ahead of time in any way. Hashed searching is generally the fastest, as long as one has enough buckets for all of the ships; if one is worried about the case where too many ships happen to fall into the same bucket (in which case the search would be very slow), then binary searching would be better.
p) q) r) s) t)
Version 1
12
b)
c) d)
e) f)
g)
h)
i) j)
Version 1
13
b)
c) d)
Version 1
14
Version 1
15
s)
The second one is faster. Whereas the first network requires all comparisons to be done serially, one after the other, the second has some being performed at the same time. The first network is an example of serial processing, whereas the second uses parallel processing to run faster.
Networks can also be used to perform other computations across a set of inputs. t) u) v) w) The single output is the maximum of all of the inputs. Yes, each new person and shovel can dig a new part of the ditch. No, to dig a deeper ditch, one must wait for the earlier parts of the hole to be dug. You can accelerate meal by having different people make different dishes or cut up different ingredients; you cant parallelize actual baking or cooking of a single dish, since it takes that long for it to bake. Multiple pieces of clothing are all washed together. You can dry one load of laundry while another is being washed. But, you cant wash and dry the same piece of clothing at the same time!
x)
Version 1
16
b) c)
To walk from A to C on paved roads, one must walk from A to B to C. This is one possible solution that paves 7 stones; other paths of 7 stones are possible.
d) e)
To walk from A to D, one first goes to house B. The following paths are also just as good, since all houses are still connected using 7 tiles.
f) g)
Would prefer the direct path from B to E is paved, as in the first solution. Planning how water pipes should be laid out in a city, or gas lines, or electrical lines.
Version 1
17
h) i)
10 How the graph looks isnt important, as long as house A is connected to B with a length of 1, house B to house C with a length of 2, and house C to A with a length of 3, and no other connections. The graph is as follows.
j)
Version 1
18
b)
c) d) e) f)
g) h)
Version 1
19
A A
b)
Answers will vary. One possible path is from Pirates Island take ship B to Musket Hill , then ship B to Mutineers Island, then ship A to Smugglers Cove, and finally ship B to Treasure Island. The following is a complete map.
c)
d)
The quickest route from Pirates Island is take ship B to Musket Hill , then ship B to Mutineers Island, then ship A to Smugglers Cove, and finally ship B to Treasure Island.
Version 1
20
e)
There are many possible slow routes. One slower route that hits all of the islands would be from Pirates Island take ship A to Shipwreck Bay, ship B to Dead Mans Island, ship A to Musket Hill, ship B to Mutineers Island, ship A to Smugglers Cover, and B to Treasure Island. Lots of paths involve loops. For example, one could travel between Pirates Island and Musket Hill many times before proceeding to Mutineers Island. Answers will vary. Answers will vary. Answers will vary.
f) g) h) i)
Version 1
21
Version 1
22
y) z)
An example sentence is : a friendly dog and the old pirate laughed.? Answers will vary.
Version 1
23
d) e)
Hopefully the pictures look fairly similar. When the person describing the picture doesnt get to look at what is being drawn, mistakes cant be fixed. There is no way for the describing person to know that there is a problem if they cant see the picture. This is the hardest case because there is only one-way communication between the describer and the drawer; if there are any problems, the describer wont know until the very end. It is important that programs are well written. A small error can cause a lot of problems. With an error, the space shuttle could miss its destination, the power plant could blow up, or two trains could hit each other. In all cases, people could die!
f)
g)
Version 1
24