Вы находитесь на странице: 1из 117

Computer Science

Unplugged

:
Tim Bell, Ian H. Witten Mike Fellows

:
Robyn Adams Jane McKenzie
Matt Powell

:
:
2010


2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


.
. ; ;
, , ;
. ,
, ,
!

.
' . ,
.
;
.
, .. ,
, patterns .

. ,
, , ,
.
3 2
. .
, . ' ,
(unplug) .
download, ,
Google, Inc.

Creative Commons Attribution Non


Commercial - NoDerivs, , ,
,

).
, ).

, .
(
www.unplugged.org).
. ,
.


2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.
.
South Park School (Victoria, BC), Shirley, Ilam
Westburn (Christchurch, )
. : Linda Picciotto, Karen Able, Bryon Porteous, Paul Cathro,
Tracy Harrold, Simone Tanoa, Lorraine Woodfield Lynn Atkinson,
. Gwenda Bensemann
. Richard Lynders Sumant
Murugesh .
Ken Noblitz.
Victoria Mathmania Kathy Beveridge.
Malcolm Robinson Gail Williams, Hans Knutson. Matt Powell
project Unplugged.
Brian Mason Scientific Technical Trust
.
Paul Ruth Ellen Howard,
. Peter
Henderson, Bruce McKenzie, Joan Mitchell, Nancy Walker-Mitchell, Gwen Stark, Tony Smith, Tim A. H. Bell1, Mike
Hallett Harold Thimbleby.
: Bruce, Fran, Grant, Judith Pam
, Andrew, Anna, Hannah, Max, Michael Nikki,
2 .
Google Inc. Unplugged project
download.
.
www.unplugged.org.

1

2
, , Michael.

ii


2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


.............................................................................................................................................................................. i
......................................................................................................................................................................... ii
.................................................................................................................................................................. i iiiv

: : H - A ................................................... 1
: ................................................................................................................................................ 2
1 : ............................................................................... 3
............................................................................................................................................................. 4
: .............................................................................................................................. 5
: ...................................................................................................... 6
: ...................................................................................... 7
: ........................................................................................................... 8
: modem ............................................................................................ 9
: 31 ...................................................................................................... 10
...................................................................................................... 11
;.................................................................................................................................................. 12
......................................................................................................................................................... 13
2 : : ............................................... 14
.................................................................................................................................... 15
: ........................................................................... 16
: Kid Fax ...................................................................................................................................................... 17
: ...................................................................................................... 18
: ...................................................................................................... 19
; .................................................................................................................................................... 21
......................................................................................................................................................... 22
3 : ! .............................................................. 23
! .................................................................................................................................................... 24

2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.iii

: ......................................................................................................... 25
: ! ....................................................................................................................... 26
: Extra .................................................................................................................................. 27
: , K ........................................................................................................... 28
: Extra .................................................................................................................................. 29
; ................................................................................................................................................... 30
4 : ........ 31
............................................................................................................................................................... 32
, ............................................................................. 34
: Detective ..................................................................................... 35
; .................................................................................................................................................. 37
........................................................................................................................................................ 37
5 : - .......................................................................... 39
..................................................................................................................................................................... 40
....................................................................................................................................... 41
: ............................................................................................................................... 42
; ................................................................................................................................................... 43
......................................................................................................................................................... 44

: - ..................................................... 46
.................................................................................................................. 46
6 : .............................................................................................. 47
................................................................................................................................................................................ 48
................................................................................................................... 49
..................................................................................................................... 50
Hash ........................................................................................................................... 51
................................................................................................................................................. 52
; ..................................................................................................................................................... 65

iv


2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

7 : .................................................... 66
.............................................................................................................................. 67
: ...................................................................................... 68
: .................................................................................... 69
; ........................................................................................................................................... 71
................................................................................................................................................. 72
8 : ............................................................................. 73
..................................................................................................................................................... 74
: ........................................................................................... 75
; ......................................................................................................................................... 77
9 : - Minimal Spanning Trees ................................................................ 78
.................................................................................................................................................... 79
: ....................................................................................................................... 80
; / ............................................................................................. 82
10 : .............. 83
. ................................................................................................................................... 84
; ....................................................................................................................................... 86

III :

................................................................... 87

.......................................................................................... 88
11 : finite states) ............................................................. 89
............................................................................................................................................... 90
.......................................................................................................... 92 /93
........................................................................................................................................................... 94
: ....................... 95
: (4 ) .............................................................. 96 / 99
Finite State Automata (FSA) ................................................................................................................................ 100

2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: ....................................................................................................................... 101
: .......................................................................................... 102
; ................................................................................................................................................ 103
......................................................................................................................................................... 104
12 : ............................................................... 105
................................................................................................................................................................. 107
; ................................................................................................................................................. 108

vi


2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: .

: .
;
computer computare, ,
! ,
, ,
. ; ,
: 0 1.

;
, .
(, , ) .
, , , , , ;
, ,
, ,

.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

0 1.
;
*

(*. .: )

: 2 . .
.
: 2 . pattern '
pattern. patterns .

:
:


, set ( . 6).
A4 smiley ( ) .
. 6 .
O :
set .
. 6 .

(. 5)
' ,
:

: (. 7)

: (. 8)

: fax modem (. 9)

: ' ' 31 (. 10)

: (. 11)

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.5,
.
' , 5 , ,
. 5 , , ,
, :

; (
).
, ' ; (32) ; ...
,
.
.
6 ( 4 2), 15 ( 8, 4, 2 1),
21 (16, 4 1)...
0.
,
( ). 5
.
, 0. ,
1. .

01001 (: 9)
17 (: 10001)
' .
' .
.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

:

; , !
; ,
, , , , !
,
.

16 '
, :

.
, , , 5 .

3 , 12 19.
; ;
; , ;
Extra : 1, 2, 3, 4 .
, ;

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

:

. 0 , 1
. :

10101; 11111 ;
; .
, .

Extra : 1, 2, 4, 8 16 ,
, 31 . , ,
() 1, 2, 4, 8, 16 ,
, , 0 32 .

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

:
Tom .
, .
, , . Tom
.
; Tom . !
, ! Tom
. ,
. ;

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: modem
modem,
. . beep
1, 0. .
, , modem ,
, . ,
fax, modem .

Tom ,
.
modem, !

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: 31
. ,
; ;
; ,
.
, :

1, 2, 4, 8, 16...
: 1 + 2 + 4 = ; ;
: 1 + 2 + 4 + 8 = ;
, ;
, , .
10; , ,
10, !
, 0 31, ,
. , ' 2,
' 4 ' . 32
( 0 !)
, 1, .
, 0.
, 0 1023! 1024 !
(' ' ),
. 32
, 2 32 x 32 = 1024 ,
, 20 ;

10

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: .
1. ,
.
10 (), ,
10. .. 9 90, 30 300.
;
:

1001 10010
(9)

(?)

, . ;
, ;
2. , bit ( bit binary
digit ). , ,
5 , 5 bits. ,
, , , ,
$ %.

. bit , ,
;
, SCII
(American Standard Code for Information Interchange,
), bit .
, , , , ,
, ., bit.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

11

;
.
. (
, ). (0 1) bit (binary digit). bit

.

, ,
, , 1 0.
(floppy ) , bit
.
- - .

CD, CD-ROM DVD, bit :


bit, .

bit , ' bit


. bit, byte 0 255.
bit . ,
32 bit, , 32 bit. 16 bit,
32 bit,
, , .
bit byte
, . , ,
, .

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

12


(. 5)
3 2 1
12 8 4
19 16, 2 1
( ) .
31, 0.

.

Extra : , ,
, (
, , , , ).

(. 7)
10101 = 21, 11111 = 31
(. 8)
Tom: .

' 31 (. 10)
,
.
1024 1024 = 1,048,576 - 0
1,048,575!

(. 11)
, .
1 (. )
( ),
. ( 10,
, 10, ).
7 bit . 128
. , 7 bits byte 8-bit, 1 bit
.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

13

2
-

, , .
.
*

(*. .: )

: 2 . .

, (. 16)

14

: Kid Fax (. 17)

: (.18 . 19)

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

:
1. fax;
2. ; ( ,
, )

3. , ;
( ,
, ' ).

, pixel (picture element,


).
, .
a , pixel .
, ,
, .

1, 3, 1
4, 1
1, 4
0, 1, 3, 1
0, 1, 3, 1
1, 4

. 1
pixel, 3 1 . 1, 3, 1.
O pixel .
pixel , 0. . 23,
, .

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

15

:
a PC, o, pixel
.

1, 3, 1
4, 1
1, 4
0, 1, 3, 1
0, 1, 3, 1
1, 4

16

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: Kid Fax
. , '
!

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

17

: .
,
, ; ,
, ,
. ,
. (: ,
).

18

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: .
Extra : ,
(.. 0 , 1 , 2 , .). , pixel
: pixel, .
/ ,
. !

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

19

.
1. , ,
, .
2. ' ,
, ' .

.
pixel,
. 12 pixel,
3 bit , , (7);
( pixel, pixel ,
, ).

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

20

;

1000x2000 pixel, , modem, fax,
pixel , , . ,
pixel (.., ) pixel ( ).
pixel.
, .
, run-length encoding (
), . ,

. fax .
, . ,
fax.

( ).
web.
,
.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

21


: Kid Fax

22

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

3
! -

,
.
. ,
.

* :

(*. .: )

: patterns .
: . .

, ! (. 25)

: ! (. 26)
: extra (. 27)
: , (. 28)
: Extra (. 29)

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

23

. ,
.
.

.
. 25. .
,
; , ,
.

..., .... ....

24

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: !


.

;

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

25

: !
, .
, ;
.

........

'

...

.........

........

...

........

...

'

......

...

....

; puzzle.
.
, ,
.

: !
: ,
( , ..., , ..., ).

: .
, .
puzzle,
.

26

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: xtra
puzzle;

B a n -- - , , , , .
, , . '
, , .
.
.
, ..:

Banana
Ban(2,3). 2 2 ,
' .

Ban-- 3 .

Bana-BananBanana
2 , ,
2 , . ,
2 .

, , .
;

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

27

: , ...
;
.
2 .
( ,
, ).
.

,
- ,
, ,
,
, ,
-

28

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: xtra
;

499 2281 ,
( , ).
; 2
. !

' , ,
. ,
. ,
look .
.
,
, . - , .
", , !" .
" !" .
" , " ,
. -
. , , .
", , !" .
" !" .
" , " ,
, , -.
.
, ' .
", , !" .
" !" .
" , " ,
, , , . , :
! , , . ,
, !
, ' ' ,
. ,
, . '
, , ' .

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

29

;
/ , 25
, , !
' , .
, ,
. (files)
, .
, .
' .
, .. , ,
modem , .
, .
,
.
.
,
, Ziv-Lempel , , LZ,
( . Ziv . Lempel) '70.

. zip
GIF modem . modem,
, , .
,
. Morse .


! (. 26)
, ,
' ,
, ',
.

30

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

4
&

,
, . ,
.
.

(*. .: )

: 3 . (computation)
(estimation).
3 . Patterns .

36 , .
( ).

36 , .

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

31

.
, (
, . ,
.
, .
1.

/ / 5
x 5, .

, , .

, . , ,
.
2. / , .
, ,
, .
;

32

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

:
1.

, 5x5.

2.

;
; .

3. 6o , ,
. (parity card).
4. 6 , .
5. . ; (
). .
6.

, .

:
1.

. . ,
( ), ( )
0 , 1 ,
.

2.

2 ; ( 2
, , . ,
1 2 , . 4 ,
bit , , , ).

3.

, .
, ' ,
. '
; (, ).

4.

' (
). , , ; (
). ,
; , ,
; ( , ,
, .
5x5, 5x9 4x6, 3x4).

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

33

, .
.
, 10 , .
, bit .
ISBN (International Standard Book
Number), , .

.
:
10, 9, 8 ' ,
2 , , .
, ISBN 0-13-911991-4, :

(0 10) + (1 9) + (3 8) + (9 7) + (1 6)
+ (1 5) + (9 4) + (9 3) + (1 2)
= 172
11. ;

172 11 = 15 7
, ( checksum ) ,
11, .

11 7 = 4
. ISBN; ! !
4, SBN ,
.
10 , , .
X.

(UPC barcode)

34

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

, (barcodes)
supermarkets. ,

, formula. supermarkets
scanner: laser, ,
, ,

. scanner ,
bip .
scanner , , scanner
, ,
. ' , !

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

35


- Detective

ISBN. .
.
, ISBN.

;
ISBN.
:

, .. ,

X ;
, 11 X.
;
;
( );

36

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

;
10 .
. ,
10 1000 .
, .

.
-
. , ,
, ,
- . , ,
, ..
, .
, ,
, ,
, ,
!
(
error detection) (
error recovery).
,
. bit ,
. , , , ,
.
,
.
, , '
. ,
.
; :
::,;

A:.


..
. , .. 2 (
3), 3 ( 2), .

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

37

(
,

:
: ' : , ;
: .
:

:
, , .
.
,
, .
attraction Disneyland California.
, ,
. ( parrotty error), parity error,
.
, bit odd
, bit !

38

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

1000 ;
1000 1000 , Tolkien The Lord of the
rings; ,
. , ;


, .
.

10

, :

: (. 42)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

39

1.

2.

;
;
; ' ; 400 ,
bla, bla, bla, ;

'
! ' ..
- ,
.
, , ,
.
;
. :
,
. ,
.
,
. .

40

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


. ,
, . ,
.

:
:

1 100
1 1000
1 1,000,000.

6 , .

(.. 2, 4, 6, 8, 10)
. .


; ;
' 1 100, 7
, . ..:

50;
25;
37;
43;
40;
41;
42!

.
.
.
.
.
.
!

, 1000,
10 , 3 4 .
,
.
, astermind.

: ;
, ,
.
46 . ,
. ,

. ' -.
; ; ;
' .
.

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

41

:
,
.
(. decision tree)
0 7:

/ 5;
/ ;
, : 0, 1, 2, 3...
, ( 1).
. = 0 = 1, ;
, ,
, , ' .
0 15.

Extra : ;
;

42

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

;
Claude Shannon, (
-), .
bits: / ,
1/0 bit.
, ' , . ,
. '
, , .
, ,
1 bit: .
9 10 , 1 bit:
, , .
/ ;
,
2 ; ,
~ 80% . 20% ,
, 2 . , ,
!
Shannon .

, .
, ,

.
.
, bit
. ' ,
. , (bit) ,
!
!
(interface) ,
! ,
.
. , , 2
/ ,
mouse .
SMS .

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

43


/ , 1 bit
50 ; , 20 60;
, ,
. 3 011
- , ,
0 1 .
, ' ,
.
,
.

44

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


, ' ..
, , , .
, ,
, .
.
.
.
, ,
, .., ,
,
container, ( 100 )
.
Mohammed ibn Musa Al-Khowarizmi, . ,
, Khowarizm - ,
, 800 .. ,
, . 1120, Dixit Algorismi -
Algorismi (, , !)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

46

.
, . 3
: , hash.

(*. .: )

: , 3 . : ,

: 3 . :

1A, 1B 1

2A, 2B 2

3A, 3B 3

1A', 1B', 2A', 2B',


3A', 3B'.

47

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)



1. 15 .
( ). .
2. 4 5 .
. . ,
, .
3. .
4. . ,
' . .
,

, , ,
. ,
3 . , .

, .
, .

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

48



1. , -. 1A, 1B.
!
2. 26
. .
3. . ( ,

. ,
, ).
,
(.. 2 ).
4. ;
: , .
( 1A' 1B' , ,
. 2A', 2B' 3A', 3B'
).


1. ;
2. ; ( 1 26 ,
.
, ).

49

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

' ,
' . .
1. , -. 2A, 2B. !
2. 26
. .
3. , . ,
.
, ,
.
, (.. 2
).
4. ;
: , .


1. ;
2. ;
3. ; ( ,
). ; (,
).
4. , ; (5 ).

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

50

hash

1. , ,
.
2. ' ( 0 9) . ,
. ,
. , 2345,
2+3+4+5, 14. 4,
. ,
. hash ( )
.
3. . ,
, .
( , 3A' 3B' ,
, .


1.

2.

; ( ).
; ( ).

3.

, ; ;

3 ; (
, .
, , 2, , , .
, , 3 1,
.

51

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


1. , 3 . 2 ,
' . hash
. ( ).
; ( ).
2. ; ( ,
26 . , 5.
Hash, ).
3. ,
( 6), 1000 ( 9), ( 19); (
.
, , ,
).

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

52

53

2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

54

55

.
2002 Computer Science Unplugged

(www.unplugged.canterbury.ac.nz)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

56

57

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

58

59

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

60

61

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

62

63

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

64

;
.
, ,
.
, .. , ,
(search keys).

.
, , .
. , , supermarket 10.000
. ,
10.000 , . '
, 10
. - !
. , .
,
. .
supermarket, 10,000 14
, .
hash. ' ,
.
, ,
, 11. , hash
4 - ,
. ,
, . , ,
, ,
.
hash ,
' , '
.

65

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

, ,
, e-mail , ' .
,
. ,
, , ' ,
.
,
, . , ,
. ' ,

.

(*. .: )

: , 2 . .

8 (..
)

: (. 68)
: (. 69)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

66

.
, . ;
, , 2 . ,
.

67

1.

2.

. . 68, .

3.

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

:
: .
: , 8
:
1. . .
2. , .
3. . ;

: .
2 .
4. 3 , ,
. ; ; ;
5. , .
, , , 2
.

(Selection Sort)
, (selection sort).

: . ,
' . ,
.
.

Extra :
8 ; 9 ; 20;

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

68

:
Quicksort ( )
Quicksort , . ,
. :
.
, .
, , .
(, , , ' ).
.
. .
,
. ,
.
;

Quicksort selection sort,


. ,
14 , . 28 selection sort. , quicksort
selection sort , , - !

Extra : quicksort, , ,
;

69

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


. ,
:

Insertion sort ( ): ,
, ( ). ,
,
, .
.
Bubble sort ( ) ,
- , '
' . .
, .

Mergesort ( )
. ' ,
( ,
). , , 2
. :
' , 2 2 .
, 40 60 gr, 2 , ,
(' )
40 gr.
; , ... Mergesort! , ,
, '
....

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

70

;
.
, ,
...! ,
, .
' , .
, '
.
, insertion sort, selection sort bubble sort,
, , quicksort.
Quicksort concept (recursion).
, .
. ()
, (').
quicksort, .
! ,
.

71

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


1. , ' , ,
, . , 2
, , .
2. . 3
2 (transitive operator), , A
B B C, A C).

:
selection sort .
2 , , 3 2, 4
3 . 8 selection sort,
7 , 6 , 5 ,
. :

7 + 6 + 5 + 4 + 3 + 2 + 1 = 28
n 1 + 2 + 3 + 4 +... + n - 1 .
, .
, 1 + 2 + 3 + ... + 20, :

(1 + 20) + (2 + 19) + (3 + 18) + (4 + 17) + (5 + 16) +


(6 + 15) + (7 + 14) + (8 + 13) + (9 + 12) + (10 + 11)
= 21 10
= 210
, 1

+ 2 + 3 + 4 ... + n 1 = n(n 1)/2.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

72

, .

, . '
, .

(*. .: )

: , 2 . : ,

73

6 .

(. 75) ,

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


,
:


,
.
1. 6. .
2. , .
3. (IN) .
.
4. ' ,
.
5. , . ,
' , , ,
.
6. ;
, .
() , '
. :

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

74

75

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


1. ,
.
2. (.. , ).
3. ,
.

1. , ; (
)
, ; ( ! T
input ).
2.
. , 3 .
.
3. 2 , 4 inputs.
; ( o 2. 1 , ,
2 . 1
, 2 ).

4. .
5.
input. , 8
: output minimum inputs (
).

; , ,
, '
.
;

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

76

;
-, ,
.

( 6 e 7).
,
, . ,
6 , 12 ,
3 .
5 .
.
.
' , 10 . 10
' , .
10 2 1 .
,
.

77

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

9
- Minimal Spanning Trees*

(* )

: , , .
, ,
. , ,
.

(*. .: )

: , 2/3 . :

:
:

: (. 80)

( 40 )

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

78


, .. .
. 94, .


. ;
,
( ), ,
,
.
. .

, ,
. , , .
;
.
, ,
.. ,
.
( ),
2 ,
.

79

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

:
- , . '
, .
.
, ,
. , , :
1.
. ,
2. .
. () ,
.
, (). ( ,
).
;

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

80

, ,
.
,
. . ,
' , , ,
. , , ' .
, .
.
;
;

81

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

;
, , ,
, . ,
.
, ,
.

(Minimal spanning tree, MST).
MST .
, , ,
. ,
, ' ,
. ,
, .
' ,
.
Minimal spanning trees ,

.
() minimal spanning trees .
, , '
, .
Kruskal ( J.B. Kruskal 1995).
, ,
.

(. 81)

, n ;
, , n1 , n ,
.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

82

10
- deadlock .

(*. .: )

( resource),
, Internet,
. deadlock (
). , ( )
.

83

2005 Computer

.
Science Unplugged (www.unplugged.canterbury.ac.nz)

. ,
. , ,
.
1. 5 , , - .
2. ,
(.. ). , .
2 .
, 1 , 2 ( ,
1 ). , .
3. , . , , ,
, . , ,
.
4. , , .
. :
) .
) '
, . (
).
greedy (.
, ),
. Greedy , .
, greedy
(incremental), , ,
. greedy , .

!
.


;
deadlock ; (
,
....)

84

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)


.

.

,
.

, ,
,
.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

85

;
deadlock , , ,
Internet.

.
, deadlock,
. .
, , ,
deadlock: ! ,
, ,
deadlock .
, ,
, .
, , . (
) , (lock operation),
. ,
. , ,
, , deadlock.
, :
A , B A. , , 2
A B.
A, B, deadlock, 1
B, 2, ,
1 A.
,
, ,
. ,
( !),
.

86

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

III



, .
, ' .
!
,
. ,
, , ,
, ! .
, robot,
, ,
.

, .
' ,
, .
1 ,
() , .
Finite State Automata FSA .
2 .
, ,
. , .
, ,
.

88

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

11
- Finite State Automata (FSA)

,
, .
FSA . FSA
. FSA: !

(*. .: )

: -
patterns


patterns

set ( ' !)
( . 110), .


, , .
:

: (. 95)

, :

: (. 101)
: (. 102)

.
2002 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

89

.
, .
, A B, .
. , (
). ,
. , ,
.


(:
). ,
, :

, 3 2 . 3
, ,
3 3 . :
' .
, A.
, .
. A.
. '
. , . '
. ' , .

90

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

, :

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

91

92

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

93


7 . 7 ,
, , .
, , .
, , .
,
, .
( , , ,
).
: ' .
:

; ;
(loops). ; ( , BBBABAB
BBBABBABAB, ).

94

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

95

: (1/4)

96

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: (2/4)

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

97

: (3/4)

98

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

: (4/4)

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

99

Finite State Automata FSA


, :

, ( )
. ,
;
: (a), ( , . . 2),
A (.. AB, BABAA AAABABA)
(b), , ( ) ,
(AB, ABAB, ABABAB, ...).
(c) B (, ,
: A, AA, AAA, AAAA, ...).

100

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

:
;
; !
1. , .
. ,
( patterns).

( , ),
. ,
. ;
2. ;
. puzzle '
Finite state Automata.
3. ,
.

, . , ,
!

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

101

:
Internet , robot
.
, 50% ,
! . ,
pattern, . ; , .
, ,
(t , c ):

. ( ) .
' pattern, ;
,
(: 4 ).

102

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

;
Finite state Automata
.
, ,
, 1 '
... 2 .... 3 .
input finite states, .
finite states, .
finite states, .
, !
.
. ,
Finite state Automaton. , Automaton
( ).
, 100 , .
( ),
. 115. ,
. '60,
Eliza ( Eliza Dolittle, My Fair Lady),
.
, , . ' ,
, , '
!
,
. ,
. finite states,
, , ,
.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

103


(. 102)
( t ,
c ) :

, 2, 3 , .

104

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

12

,
.
, ,
' ,
.
.
*

(*. .: )

: 3

' .

, .

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

105

106

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

. ,
, , :
;
, ,
' !


, ,
:
1. .
2. ,
, .
3. ,
, .
4. , .
' :

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

107


( , . 106).
.
,
, .
, .
.
, .
, .

,
.
,
. , ,
, .

.
( ,
) .

:
1. .
2. ,
, (90 ), (90 ).
, ,
.
3. :
.

108

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

;
, ,
.
, ,
.
, .
,
.
, , '
, .
, , .
, .

(space
shuttle), ,
!
bugs, , ( )
relais,
, '40.
, ,
debugging, ( , ).
, .
,
, .

.
,
.
, bugs ,
. , ,
,
' !


Creative Commons
- - 3.0 .
www.greeklug.gr.

.
2005 Computer Science Unplugged (www.unplugged.canterbury.ac.nz)

109

Вам также может понравиться