1 2 3 01 4 5 0 0 7 6 8 9 0 0 0 1 3 2 4 8 1 1 3 4 2 1 1 3 4 2 1 8 8 1 3 4 2 9 6 0 6 1 1 7 9 1 6 0 0 0 A 0 0 0 0 0 5 07 0 1 2 n n 1 3 n 1 n S n 2 2 1 S n 1 n 1 n 1 n 1 n 1 2S n n 1 2S 1 2 n n 1 3 n 1 n S n 2 2 1 S n 1 n 1 n 1 n 1 n 1 2S n n 1 2S 1 2 n n 1 3 n 1 n S n 2 2 1 S n 1 n 1 n 1 n 1 n 1 2S n n 1 2S 1 2 n n 1 3 n 1 n S n 2 2 1 S n 1 n 1 n 1 n 1 n 1 2S n n 1 2S n n 1 S 2 1 2 n n 1 3 n 1 n S n 2 2 1 S Algebraic argument n 1 n 1 n 1 6 n 1 n 1 2S n n 1 2S 1 2 n n 1 3 n 1 n S n 2 2 1 S n 1 n 1 n 1 n 1 n 1 2S n n 1 2S number of white dots 1 2 n n 1 n S number of white dots n 2 2 1 S number of yellow dots n 1 n 1 n 1 n 1 n 1 2S n n 1 2S 1 2 n n 1 3 n 2 1 1 2 n n 1 n S number of white dots n 2 2 1 S number of yellow dots n 1 n 1 n 1 n 1 n 1 2S n n 1 2S 1 2 n n 1 3 n n There are n n 1 dots in the grid n n n n n 1 n 1 n 1 n 1 n 1 n 1 n S number of white dots n 2 2 1 S number of yellow dots n 1 n 1 n 1 n 1 n 1 2S n n 1 2S 1 2 n n 1 3 n n n 1 S 2 n n n n n n 1 n 1 n 1 n 1 n 1 B 0 9 9 9 0 7 6 C D D1D C E D FG D D C C 8 D 9 8 9 8 D1 9 8 D1D 9 8 D1D 9 8 D3 D1D 9 8 D3D D1D 0 0 D3D C 8 0 0 8 0 0 7 C C 8 D C C 8 D C C D 00 D C D D1D D D D D1D D1D D3D 7 0 H 7 E E F F C 0 8 E F C 0 8 D C E D F C E F C C 0 E E F F C E F D E E F C D F C E D F D D 0 0 0 0 0 8 9 0 0 6 7 0 4 1 I 9 9 0 9 E F 8 9 8 0 8 8J 9 9 00 00 K K G9 8 8 L L 1 9 2 9 9 8 0 8 2 9 11 9 4 2 9 9 B 0 0 9 9 0 8 8 I G J 0 0 43 0 0 0 00 03 0 I B G 1 9 9 0 0 J 0 9 9 9 I9 0 J E 8 F 0 0 0 E 0 H F0 0 0 5 Enter the ancient Geeks I meant Enter the ancient Greeks 0 0 9 0 E2 9 F E 0 F 0 E2 9 F 0 K0 L 0 8 4 0 0 G H 0 0 E2 9 F 0 0 4 9 5 0 0 0 E2 0 9 F 0 K 0 0 E2 L 9 F 0 K 5 0 K 0 K L 3 L K I L L 9 J K 0 L 0 0 0 0 0 K 8 E F 5 0 0 00 L 2 9 M 0 H 0 0 H 0 9 H 7 1 9 H 0 K 0 L N N 4 1 0 K 9 H 0 L 8 I 0 0 J 0 0 0 0 4 1 0 9 H 0 0 3 O 1 3 9 0 5 14 9 A 0 K L K 6 L 14 O 1 L 9 0 0 0 K 6 6 F 0 7 F E 0 H E 0 0 0 H 0 0 H 0 H 0 0 9 0 0 1 5 E 9 0 K L 0 F 0 A H 0 0 43 9 G1 1 0 B 0 G 0 0 0 O Anagram Programming Task You are given a 70 000 word dictionary Write an anagram utility that given a word as input returns all anagrams of that word appearing in the dictionary H 9 9 E P P 0 0 F 0 0 H On input microphotographic the loop will run though 17 3 1014 iterations Even at one microsecond 10 6 per 8 iteration this will take 3 10 seconds This is about a decade About seconds in a nanocentury 10 9 K H H N L N N EN F If ANAGRAM X Y output Y 03 The hacker is satisfied and reflects no further 0 6 G 6 0 K LE F N C 0 0 0 About log2 70 000 25 microseconds 0004 seconds Of course it takes about 30 seconds to create the dictionary but it is perfectly fair to think of this as programming time The building of the dictionary is a one time cost that is part of writing the program 0 0 0 H H 00 8 00 0 0 A 0 6 0 5 9 0 0 0 9 0
View Full Document
Unlocking...