Está en la página 1de 67

1.

1.1

, , , .
1.2

3

, .
, , ,

, Pasteur Fleming,
.

.

1.3
;
,

.
1.4

.
1.5

. , , .
1.6


.
2.1
.
1.7

,
.
1.8

, .
1.9


.

-1-

, .
1.10
. .
.
.

. ,
.
.

.
,
, ..
,
.
1.11
,

,

, , .
1.12 , .
, . , ,
.
,
, , .

, .
,
, .
.
,
.

1.13 , .
, . , ,
.

-2-

,
,
.
, .

1.14 ,
.
,
,
.
.
, ,
. .
,
.

.
1.15 .
,
,
,
.
1.16
, ,
,
, ,
, .
1.17

.
:


,

, .
, .
-
1)
.

-3-

2)
.
3) , , .
4) .
5) ;
6) .

-4-

2.
2.1
, , .
2.2
(input).
, . , .
(output).
.
(definiteness).

. , ,
.
(finiteness).

.
,
(computational procedure).
(effectiveness).
. , .
2.3
;
.
2.4
H ,
:
(hardware). ,

.
(programming languages).
(, ) .
(theoretical).
, .
(analytical).
(computer resources) ,
, CPU / ..
2.5
;

-5-


, .
2.6 :
(free text),
.
,
.
(diagramming techniques),
.
, ,
(flow chart).
, .
(natural language) .
,
, ,
.
(coding),

.
2.7
, ,
, ,
, ,
, .
2.8 ()
( ) ,
.
2.9
, , .
2.10

, .
,
2.11

(constands). .
2.12


, .. 123, +5, -1,25
.. ,
,
2.13

-6-

(variables). , . , .
2.14

, :


.
2.15

(operators). . , .
2.16

(expressions). (operands),
.
.

. .
2.17
.
_
// //
// //
2.18
.
_
// //

// //

_
2.19
;.
(!) .
2.20
.

mod

div

^

2.21
;
. ,

-7-


. , .
2.22
;
.
2.23
;
.
2.24

... , ( )
....
, .
2.25

2.26
;
, , .
2.27
;
.
2.28
;
.
2.29
:
_
_ _
_
2.30
_ .

-8-

2.31
_ _ .
_

2.32
_ .
i _

2.33
;
_
.
_ _ .
_ .
2.34
k n n ;

2.35
k n 1 ;

2.36

; ;
( ), , . , , .
, , , 45 19.
- ,
. ,
. ,

-9-

,
. ,
.

45
19
45
90
9
90
180
4
360
2
720
1
720
= 855
,
. ,
, .

. , ,

(shift), .
.
.
:
( )
:
M1 M2, M1, M2 1
:
P=M1*M2
1:
P=0
2:
M2>0, 3, 7
3:
2 , P=P+M1
4:
1=1*2
5:
2=2/2 ( )
6:
2
7:
P.

.
__
// 1,2 //
P 0
M2 > 0
M2 MOD 2 = 1
P P+M1
_
M1 M1*2
M2 _(M2/2)
_
// P, 1,2 //
__
2.37
(shift)
( 0
) ,
(

- 10 -

) .

2.38

1)
: , +, ,
: ,
: , .
2)
, , _
(underscore). ,
.
3)
+, -, *, /, ^
: <=, <, =, <>, >, <=
: (), (), ().
4)
, , , .
5)

6)

<> < >

<>
<>
_


<>
<_1>

<_2>
_

( )

1
_1
............

_

_
_

- 11 -

( )
<_1>
<_1>
_ <_2>
<_2>
......
_ <_>
<_>

<_>
_

7)

<>

_ <>

1 2 _

8)
, , , ..
9)
, , ,
..
10)
-
, !, !.
11)
<_> <_>
12)
( )
// ... //. // ... //.

- 12 -



1) .
2) .
3) .
4) .
5)
.
6) , , .
7) .
8)
.
9)
.
10) .
11) ,
.
12)
( ).
13)
.
14)
.
15)
.

1) :
)
)
)
)
2)
:
)

- 13 -

)
)
) /
3) :
)
)
)
)
4) 138
) =138
) =:138
) :=138
) 138
5) :
)
)
)
)
6) :
) A+B = 10
) A B*3
) A+B 12
) A 2*B 22
7) :
)
)
)
)
8) :
)
)
)
)
9) :
)
)
)
)
10) 2 :
) .
) .
) .
) .
11) 2 :
) .
) .

- 14 -

) .
) .
12) :
)
)
)
) .

1) , ,
.
2)
.
3) .
4) M ... .
5) __ .
6) i .. .. ..
.

7) _______________ ,
.
8) ()
______________
9) _ ______________
10) ______________ 1 2 _ .
11) _____________ ,
.
12) _____________
..
-
1. .
2. ;

- 15 -

3. ;
4. ;
5. .
6. / ;
7.
.
8. .
9. .
10. .
11. .
12. .

- 16 -

3.
3.1
(data)
(data), ,
.
, . , , , , .,
, .
3.2
(information).

(information).
,
.
3.3
(Information Theory)
. , , , . , ,
,
(Information Theory), .
3.4

:
1) .
(hardware), , (representations).
, SCII (. ),
EBCDIC, 1 2 ..
2) .
(high level programming
languages) (types) (variables)
.
, ,
.
3) .
(data structure)
. , (record), , .
(fields) (attributes)
, , .
.
.
4) .

. (Databases), (Data Modelling)

- 17 -

(Knowledge Representation)
.
3.5


.
(nodes).
3.6
()
( ) :
1) (access),

.
2) (insertion),
.
3) (deletion),
,
.
4) (searching),
, .
5) (sorting),
.
6) (copying),
.
7) (merging),
.
8) (separation),
.
3.7

. , ,
, . ,
.
3.8
,

.
3.9

1976 Wirth ( Pascal)


+ =

3.10
: (static)
(dynamic).
3.11

- 18 -

5)
(dynamic memory allocation).
6) ,
.

7)
8) ,
.
3.12
( , .).
3.13

(indexes) .
3.14
,
, - .
3.15
(square) n x n.
, .
3.16 ;

( ), .
(LIFO Last In
First Out).
3.17 () .
() :
(push) ,
(pop) .
3.18 ;

3.19 ;
.
3.20 ;

3.21 ;

- 19 -

3.22 ;
.
3.23
;
.
;
top .
top top+1 ( )
top top-1 (
).
3.24

3.25 ;

( ), ( ). (FIFO First In
First Out).
3.26 () ;
() :
(enqueue) ,
(dequeue) .
3.27 ;
.
3.28 ;
.
;
,
.
3.29


;
,
.
3.30

3.31 .
, ,
.
;
front (
) rear ( ). rear rear+1 ,
front front+1.
3.32

3.33

- 20 -

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

1/1/02
4
10
40
15/1/02
6
12
72

10
112

/
30/1/99

100


20

.

/
1/1/02
15/1/02
30/1/02

4
6


4
10
5

40
72

40
112

.
,
.
) LIFO
30/1/02 5 6
, 12 .
=5x12 = 60 . =112-52=60.
100-60=40.
) FIFO
30/1/02 5 , 4 1/1/02
1 15/1/02. =4x10+1x12=52
=112-52=60. , 100-52=48.

- 21 -

)
,
. 112/10=11,2.
=5x11,2=56 =112-56=56. 10056=44 .
3.34


;
.
.
.

3.35 ;
(sequential) (linear) .
3.36 .

.
. , , ,
.
,
10
100.
2
3
5
-1
100 2
2
30
:
1 : .
2 : 100. 4
, 3 .
3 : ;
2 . 5 .
4 :
.
5 : ,
.
;
3 :



3.37


___
// , , //
! : , : , :

i 1
[i] =
3.38

- 22 -

" ", i

_
_
=
" "
_
___
3.39

___
// , , //
! : , : , :

i1
i <= =
[i] =
" ", i

_
i i+1
_
=
" "
_
___
3.40

___
// , , //
! . , : , :

i 1
[i] =
i

_
_
=
" "

" ",
_
___
;
,
. , :
,
( , n 20),
3.41

- 23 -

3.42 ;
a1,a2,...,an (permutation)
, ak1,ak2,...,akn , (ordering function), f, :
f(ak1) f(ak2) ... f(akn)
,
(descending
sequence) .
3.43 ;
(straight exchange sort)
,
.

.
- (bubbles) ,
.
3.44


// table, n //
i 2 n
j n i _ 1
table[j-1] > table[j]
table[j-1], table[j]
_
_
_
// table //

table[j-1], table[j]
.
.
temp table[j-1]
table[j-1] table[j]
table[j] temp
3.45 (files) ;
(.. ). , , ,

, , .
3.46

- 24 -

(records),
(fields), ,
.
3.47

;
( )


(quicksort) ( )



1) 1,90.
.
2)
3)
4)
5)


6) .
7) -
/, .
8) .

1) .
2)
.
3)
.
4) ,
.
5) .
6)
.
7) .

- 25 -

8) .

1) ;
.
2) ;
3) .
4) ;
5)
;
6) .
7) .
8) .
9) ;
10. .
10) ;
11) .
12) .
13) .

- 26 -

4.
4.1 ;
,
,

:
,
.
4.2
;
;
;
( );
(.. );
(..
)
4.3 ;
,
( ),

,
.
4.4
,

.
4.5




4.6 ;
.
4.7 ;


. .

- 27 -


1) , . .

.
4) () .
5) .
6) .
7) .
8)
.
.
10)
,
.
11) , .

1) :
)
)
)
)
2)
:
)
)
)
)
3) :
)
)
)
)

1) _______________ .
2) _________________ ,
__________________.

- 28 -

3) _____________ ,

.
-
1)
;
2)
;
3) ;

- 29 -

5.
6.1

;
.
.
.

6.2
;

, ,
, .
;
1945 , . ,
.
6.3

;

() (). , .
6.4

6.5
;
0
1 (
), .
.
, ,
.
6.6

,
0 1.
6.7

;
.

, .
, , .

6.8
;

.
6.9

- 30 -

,

;
1957 IBM FORTRAN.
FORTRAN FORmula TRANslation,
. FORTRAN
. .
4, 77, 90/95 Visual FORTRAN.
6.10

6.11
(assembler).;
,
(assembler). .
6.12
COBOL ;
1960 ,
COBOL. COBOL (Cmmon Business Oriented
Language - ) , ,
FORTRAN . COBOL Grace Marray Hopper
1960.
6.13
ALGOL ;

,
ALGOL (ALGOrithmic Language ).
, 1960,
.
6.14
PL/1;
60 PL/1 (Programming Language/1
1) ,
, , FORTRAN COBOL .

6.15

. 60 LISP (LISt Processor ),
PROLOG (PROgramming LOGic ) 70.
( , , ..).
6.16
BASIC;
BASIC (Beginners All Purpose Symbolic Instruction Code ) 1964 Dartmouth
College Kemeny Kurtz. .

- 31 -

6.17


PASCAL;
PASCAL ( Niklaus Wirth)
. 1970 ALGOL.
,
.
.
6.18
LOGO;
LOGO 1967 Seymoyr
Papert. .
- .
6.19
C;
C BELL Unix, ,
Pascal
.
6.20
C++
C C++, .

70 .
6.21
JAVA
,
(Internet), JAVA. H JAVA
SUN , ,
.
, .

. ,
, .
6.22
LISP
LISP 1959 . -
. ,
, .
6.23

.
6.24

,
.
6.25

dBASE

- 32 -

dBASE 70 Ashton-Tate 8-bit .


dBASE () .
6.26
4 ;
, ,
.
6.27


:
. .
.
. .
.

.
,
.
6.28


.

(procedural) . , . :
(object -oriented languages)
(functional languages) .. LISP
(non procedural languages) .. PROLOG. .
(query languages) .. SQL.
.
:
. .

. :
(science-oriented languages) .. FORTRAN
(business-oriented languages) .. COBOL.
.. BASIC, Pascal.
(system programming languages) .. C.
(artificial intelligence languages) .. LISP, PROLOG.

- 33 -

.
.. , ,
, , ..

6.29

, .
6.30
;
, , , .
6.31
;
, ,
.
6.32
;

.
: 48 (- -), 10 (0-9)
. (A-Z a-z) .
6.33
;

, .
, ,
.
6.34
;
(accidence)
(syntax).
6.35
;
. , ,
, .
6.36
;

.
.
6.37

(Semantics)
.
, .

- 34 -

6.38
;

. , ,

, .
,
.
,
. ( GW-Basic QuickBasic)
( Basic Visual Basic).
6.39

6.40


(top-down program design) , , , , .

,
.
.
.
6.41

, (module),
.
,
, .
6.42
GOTO;
GOTO , .
.
, (structured
programming). 1960.
1964 Bohm
Jacopini .
, 1968 Edsger Dijkstra
6.43

- 35 -

. GO TO Statement Considered Harmful GOTO .


,
.
,


. ,
GOTO .
GOTO .

6.44


,

, ,
.

6.45



, , .

.
.
6.46


;

,
.

GOTO;
, GOTO .

, .
GOTO
.
6.47

6.48
;
.
.
.
.
.
.
.
6.49

- 36 -


70 . (object-oriented) .
.
6.50
;
, (objects). ,
.

;
,
.

6.51

6.52


. . , . ,
.

OCCAM.
6.53
;
.
, (compilers)
(interpreters).
6.54


. .
6.55


.
6.56
;
(source), (object).
6.57

, .
,

- 37 -

(libraries) .
(linkerloader).
6.58
;

(executable), .
.
6.59
;
,
.
. , .
6.60
;
,
.
6.61
;
,
,
6.62
;
, ,
.

. . , .

;
, ,
.
. ,
, .
6.63

, , ;
, .
6.64

6.65
;
(editor). ,
.
6.66
,
;
,

- 38 -

-
1. ;
2. ;
3. ;
4. ;
5. ;
6. ;
7. ;
8. ;
9. ;
10. ;
11. ;
12. ;

( )

(
)

13. ;
14. ;

.
1)
.
2) .
3) .
4)
.
.
5)

.
.
.
6) Basic
.
.

- 39 -

.
. .

7) :
.., ..
8) .
....

- 40 -

6. -

7.1


,

.

.
7.2 ;
:
, .
, .

. ,

. ,
.
, ,
.
7.3 ;
, .
, Pascal, Visual Basic, C, C++, Java ,
.
.
7.4 ;


o (-)
o (-)
,
o (-)
o (a-z)
,
o 0-9
, ,
o + - * / = ^ ( ) . , ! &

- 41 -

7.5 ;
:
, ,

.
7.6 ;
.
. , . 1, 3409, 0, -980.
7.7 ;
. . 3.14159, 2.71828, -112.45, 0.45
. , .
7.8 ;
. .
. , ,
, 15 .
, . , , .
7.9 ;
. . .
7.10
(constants)
. , , .
7.11
,
( , ).
7.12

-1 = --1
-2 = --2
.
.
.
- = --
7.13 ;
(bytes).
bytes .
.

- 42 -

(integer) 1, 2 4
bytes (real) 4 8 bytes.

7.14
, ( ) , .
(-, -), (0-9) (underscore) (_),
.
7.15 ;
, , , , .,
. .
7.16
:
o , , , _, 100, , , _.
:
o 100, , $.
7.17 ;
.
, .
.
.
7.18 ;
, , , .
7.19 ;
, ,
,

_,
.
7.20 ;

-1: --1
-2: --2
.
.
.
-: --

- 43 -

, , ,
,
.
7.21
: , ,
, .
:

+
*
/
^
DIV
MOD

7.22 ;

. :
()

()

()

_()


()
()
ex
A_M(X)

_()

7.23 ;
, (expressions).
, , , .
.
,
. ,
, .
7.24
,
1.
2.
3.
, .
. .
7.25

- 44 -


.
.
7.26 ;

-
.
, , , .

(=). , , .
7.27 ;
, ,
.
, , .
7.28 -
.
.
(,).
, .
.
.
, ,
.
.
.

. .
,
.
7.29
, . ,
.
.
,
.
, .
, . _.

- 45 -

, _.
.
, &.
(!),
.


, .
, , .

1) .
2) .
3) .
.
4)
) <-+1
) <- +1
) <- 1
) +1<-
159
5) :
(5+4/2*2)*2-(3*2+5-3)^2+9/3-2
) -53
) -37
) -125
) 45

6)

.
=3.14

.:,


<-*^2
:, ..
..

1) . ;
2) ;

- 46 -

3) ;
4) ;
5) ;
6) ;
7) ;

- 47 -

7.
8.1
, . .
8.2
, , , , .
,
. .
8.3
.

=
<>
>
>=
<
<=

=0

1 <>

>10000

+ >= (+)/

^2-4** < 0

<= 500

8.4 ;
, .
. .
,
.
,
.
(=) (<>),
.
8.5 ;
,
.
8.6 ; .

,
.
, , .

0<<5
>0 <5
=1 =2 =3
=1 2 3
.

- 48 -

8.7
.
.
..., ......
...... . _.
( ), _.
,

>=0
_()
_
8.8

-1
-2

-
_
8.9

-1
-2

-1
-2

-
_
8.10 _
-1
-1
-2

-
_AN -2
-1
-2

-1
-2

-
_

- 49 -

8.11
... ...
.
8.12 ;
,
, :

__1
_1
__2
_2
......

_
_
8.13

.
8.14 ;
, , . , .
8.15 ;
,

,
_

, .
8.16 ...;
... . , , .
... . ,
.


-1
-2

-
_

- 50 -

, ,
.
.
8.17 ;
,
.

. , .
.
8.18 _;

.
... _ .
_ .
, _.
_
.

_
-1
-2

-
_ -

_.
_
8.19 ......;
,
.
, .
, . ,
( _).
. , .
,
,
_.
, 1, .
......
.

1 2 _ 3

- 51 -

-1
-2

-
_
8.20
;
....,
.. ...
.
.
8.21 ;
. , .
.

.


1) .
2)
.
3) .
4) 10 20 ( >8 <20)
(>10 =10) .
5) .
6) - .
7) ,
.
8) .
.
9) :
0
5
10
>10
>20
>10

2*
_

- 52 -


<10

_
_
. 0
. 10
. 5
. 20
10)
10
<>0
1 5
-1
_

_

. 10
. 0
. 2
.
11) .
,
<

_

12)
.

0
_()


_
13)

10.
<-
1 10
+ ^2
_

14)
100 200

_
+

- 53 -

+1
_

1. ;

2. ;
;
3. ;
4. - - _;
5. ;
6. ;
7. ;
8. _;
9. ;
10. ;

- 54 -

8.
9.1 ;
,
. . .
9.2 ;
, [ ]. .
, , , , .
.

.
9.3 ;
, .
,
. ,
.

.
. i,j,k.
,
, ,

9.4

, .
9.5 ;
. .

.
.
, .
9.6 ;

- 55 -


.
,
,
.
.

9.7 ;

, ,
. .
9.8 , ;
,
, .
9.9

. :
.
.
.
.
.
9.10 .

.
9.11 .
, , . , .
9.12 .
,
. .
,
.
9.13 ;
;
:

- 56 -

,
. .
.
9.14 ;
. ( ) ,
.


1) .

2)
.
3) .
4) 10 20
( >8 <20) (>10 =10) .
.
5) :
<-0
<-5
<-10
>10
>20
>10

2*
_

<10

_
_
. 0
. 10
. 5
. 20
6)
.
,
<

- 57 -



.

0
_()


_


.


.

1) .
2) - .
3) ,
.
4) .
.
5)
<-10
<>0
1 5
<--1
_

_
. 10
. 0
. 2
.
6)

10.
<-
1 10
<- + ^2
_

7.

- 58 -

100 200
<-
<-
_
<-+
<-+1
_

1. ;

2. ;
3. ;
4. ;
5. ; ( )
6. ;
7. ;
8. .

9. ;
10. ;
11. ;
12. ;
;

- 59 -

9.
10.1
.
.
.
10.2 ;

.
10.3
;
, .
,
.
. , , .
10.4 ;
:
.

, , .

,
.
.
,
.
.
.
, , . . , .
10.5 ;
1. .
.

.
2. .

- 60 -

.
.
,
.
3. .
. ,
. , ,
.
4. .

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

.
10.7 ;

.
, , , . , .

, .
.

, .
10.8 ;
, .
10.9 ;
.

- 61 -

10.10 ;
.
( )

_
.
,
/
.
.
10.11 () ;

.
.
,
.

- (-)

(, , )


.
. . .
10.12
.
()



>20 <0


_
_
10.13 .
20
.
_

: , i, sum
:

- 62 -


sum0
i 1 20
()
sumsum+
_
sum/20

_
()



>20 <0


_
_
10.14 ;
.
,
. , .
10.15 .
5 , 20
.
_

: , b, c, d, e, i, sum1, sum2, sum3, sum4, sum5


: 1, 2, 3, 4, 5

sum10, sum10, sum10, sum10, sum10,


i 1 20
()
(b)
(c)
(d)
(e)
sum1sum1+
sum2sum2+b
sum3sum3+c
sum4sum4+d
sum5sum5+e
_
1sum1/20
2sum2/20
3sum3/20
4sum4/20
5sum5/20
1, 2, 3, 4, 5
_

- 63 -

()



>20 <0


_
_
10.16 ;

.
10.17 ;
( ):

....

...
_
.
.
,
.

. , , , .
.
,
. .
10.18 () ;
,
.
.
10.19 ;
1) , .
2) ,
.
3) ,
, ,
.
10.20 .

- 64 -

max(, , ):

: , ,

max
> max
max
_
> max
max
_
_
10.21 .
. .

: , 1, 2, 3, 1, 2, 3,

;


1, 2, 3
1- 1
2- 2
3- 3
max(1, 2, 3)

_
max(, , ):

: , ,

max
> max
max
_
> max
max
_
_
10.22 ;

.
10.23 ;

- 65 -


, ,
.


, ..
, ,

.

-

.

.


.
.


1) .
2) .
3) .
.
4)
(=1/2**).
) (,)
)
) (,):
)
5)

<-10
<-5
(,)
,

(,)
..
<-0
<-0
,
..
) 10 5
00
) 10 5
10 5
) 0 0
00

- 66 -

) 0 0
10 5
6)
.
7)
.

- 67 -

También podría gustarte