You are on page 1of 28

2.

24

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

:
,
,
,
,
.

3 ;
3 ;
3 ,
;
3 3+6+9++999;

2.1


,


1 n.
. ,
. 25 , .


(algorithm)
Abu Jafar Mohammed ibn Musa al Khowarizmi,
825 ..
Algoritmi dixit ... ( ....). al Khowarizmi
( al-jabr=), . , .
20
.
, ,
. , .
: ,
,
.
.
(input). ,
. , -

25

26

.
(output).
.
(definiteness).
. ,
, .
(finiteness). . , (computational
procedure).
(effectiveness). .
, .
. , ,
:
3 ,
3 ,
3 ,
3 ,
3 ,
3 ,
3 ,
3 .

. ,
, , , ,
. , , -

,
(
) .

2.2

. ,
, ,
.
H , ,
:
(hardware). ,

(
, .).
(programming languages).
(, ) . ( assembly C)
( Basic Pascal). ,
. ,
(
).
(theoretical). , .
, . ,
.
(analytical). (computer
resources) , -

27

28

,
CPU / .. 5.

2.3


:
(free text),
. ,
.
(diagramming techniques),
.
,
, (flow chart).

, .
(natural language) .
, , , .
(coding), .
,

.

2.4


, .
,
. :
, ,
,
,
, ,
, .

.
..

29

30

, .
, , , , .
( ),
.

2.4.1

( )
, .

. .
.
1. A
, .

=
=

_1
a
b
c a + b
c
T _1



.
, . . , a
, a
.

31

(constands). .
, .. 123, +5, -1,25
.. ,
,
(variables). ,
. , . , , .
(operators). . , .
(expressions). (operands), . .

.
.
, ,
.
.
a b : c a + b. . :

, , . , . ,
=

. 2.1.
1

32

. .
, . . , .
a b
, c , . , (),
(), ().
, 2.1.

2.4.2


/ .

.
,

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

33

2.
.
, , , .
, ,
,
. .

+ 5 = 5 5 = 5

_2
a
a < 0 a a*(-1)
a
_2


.... :

: ( ), .
, .
... , , .
, _. .

_1
_2
...............
_
_

,
a . , (), (),
(). 2.1.

34

. 2.2. 2

3.

, , .
_3
a, b
a < b
c a + b

c a * b
_
c
_3

, :

. 2.3. 3

2.4.3

. ,
1 24,
.
.

35

36

4.

, 1 2 3 .
_4
a
a = 1
_ a = 2
_ a = 3

_
_4

. 2.4. 4

,
...
(select case), .

5.

.
_5.

;
age

age<0
...
0 age < 5
!!
5 age < 60

60 age < 100

age > 100

_
_5

2.4.4

.

... , ( )
.... ,

.
6.
. , 80 , . 1.70, .

37

38

_6
,
< 80
< 1.70
,

,
_

< 1.70
,

,
_
_
_5

. 2.5. 6

39


. . . ,

, , . . .

( )
. .

2.4.5

, . , , . ,
. ,
= *
. (
). -

40

.
7.
: ...
1
100.

i i + 1
i

.
, . , .. 5, 207, -32 . 1. , i, 1 100
1.

ii+1
i i 1.
100 i i + 1. ....
:

:
, . ,
_.
:


,

_ .

_7
i 1
i 100
i
i i + 1
_
_7

41

8:

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

. :
,
, .
, .... :
_8
x
x > 0
x
x
_
_8

,
. ,


,
.

42

. ,
, ,
.. 999999. . ...
:
x 999999
9. :
_..._

. , .
_9
_
x
E x
_ x < 0
_9

_..._

,
x .

, .
10.
: ......
100 1
100.
, ....... .

43

_10
Sum 0
i 1 100
Sum Sum + i
_
E Sum
_10

, ......
, i (=1) (=100). i
1, , 1.
Sum , 0, . Sum .

. 2.6. 10

Sum Sum+i Sum


i

44

11. :
.........

1 100.
.
, i.
_11
0
i 2 100 _ 2
+ i
_
E
_11


....... ,
, .
, .
, , :
k 100 0 _ -1
k 5 5

k 5 1

, . . , f(x) x 0
1,
x 0 1 _ 0,01
12.
,
.
. , ,
. ,
,


, , .. ,
2.7.
, . ,
. ( ), ,
. ,
,
.
, , , 45
19. - , . 2.8 ,
. ,
, . ,
.

(shift)
, 0 1, , ,
.. 17 00010001 ,
byte.
, 0 0,
00100010 , 34
. , , ,
1 0,
00001000 , 8
. , .

45

45
19
405
+ 45
855
x

. 2.7.

.

45

19

45

90

90

180

360

720

720

= 855
. 2.8. .

46


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

6.

<> <>
<>
<_1>

<_2>
_

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

_

_
_

<_1>
<_1>
_ <_2>
<_2>
......
_ <_>
<_>

<_>
_


7.

<>

_ <>


1 2 _

8.
, , , ..
9.

, , , ..
10.

- , !,
!.
11.
<_> <_>

12.
( )
// ... //.
// ... //.

47

48

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

P=0
M2>0, 3, 7
2 , P=P+M1
1=1*2
2=2/2 ( )
2
P.

.
__
// 1,2 //
P 0
M2 > 0
M2 mod 2 = 1 P P+M1
M1 M1*2
M2 [M2/2]
_
// P, 1,2 //
__

. . .
, . , , ,
.


, , , , , , , .

-
1.

2.

3.

4.

5.

6.

/ ;

7.

8.

9.

10.

.
11.

49

50

.
12. .
13.
; ;

1.

., ., .,
, , 1991.

2.

, , , 1993, .

3.

,
Pascal, Art of Text, , 1998.

4.

.. , , , 1990.

5.

D. Brunskill and J. Turner, Understanding Algorithms and Data Structures,


McGraw-Hill, 1996.

6.

D. E. Knuth, The Art of Computer Programming: Fundamental Algorithms,


Vol.1, 3rd edition, Addison Wesley, 1997.

7.

M.A. Weiss, Data Structures and Algorithm Analysis, 2nd edition,


Benjamin/Cummings, 1995


http://hissa.ncsl.nist.gov/~black/CRCDict/
, (Algorithms, Data Structures, and Problems Terms and Definitions
for the CRC Dictionary of Computer Science, Engineering and Technology)
http://www.ee.uwa.edu.au/~plsd210/ds/ds_ToC.html

, .

You might also like