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

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

.
: . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

7
16

I. . . . . . . . . . . . . .

17

1. . . . . . . . . . . . . . . . . . . . .
1.1. . . . . . . . . . . . . . . . . . . . . .
1.2. . . . . . . . . . . . . . . . . .
1.3. . . . . . . . . . . . . .
1.4. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17
18
29
32
34
40

2. . . . . . . .
2.1. . . . . . . . . . . . . . . . . . . . . . . .
2.2. . . . . . . . . . . . . . .
2.3. . . . . . . . . . . . . . . . . . .
2.4.
. . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

42
42
49
50

II. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1.
3.2.
. . . . . . . . . . . . . . . . . . . . . . . . .
3.3.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.4.
. . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4. . . . . . . . . . . . . . . . .
4.1.
. . . . . . . . . . . . . . . . . . . . . . . .
4.2. . . . . . . . . . . . . . . . . . . . .
4.3.
. . . . . . . . . . . . . . . . . . . . .

52
58

59
60
60
64
69
72
82
84
85
89
95

4.4.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.5.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5. . . . . . . . . . . . . . . . . . . . . . . .
5.1. . . . . . . . . . . . . . . . .
5.2.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

117
118
119
123
129

III. . 130
6.
6.1. . . . . . . . . . . . . . . . . . .
6.2. . . . . . . . . . . . . .
6.3. . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.

.......
......
......
......
......
......

131
131
134
137
142
143

7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.
7.2.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.3. . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

149
152
162

IV.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

163

144
144

8. . . . . . . . . . . . . . . . . .
8.1. . . . .
8.2. - . . .
8.3. -
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.4. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

164
164
167

9. . . . . . . . . . . . . . . . . . .
9.1. , . . . . . . . . . . . . . . . . . . . . .
9.2. . . . . . . . . . . . . . . . .

178

171
174
176
177

178
181

9.3. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

188
190
191

V.
. . . . . . . . . . . . . . . . . . . . . .

192

10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1. . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2. . . . . . . . . . . . . . . . . . . . . . . .
10.3. . . . . . . . . . . . . . . . . . . .
10.4. . . . . . . . . . . . . . . . . . . . . . .
10.5. . . . . . . . . . . . . . . . . . . . .
10.6. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

192
192
194
196
199
204
209
213
214

11. -
. . . . . . . . . . . . . .
11.1. . . . . . . . . . . . . . . . .
11.2. . . . . . . . . . . . . . .
11.3.
. . . . . . . .
11.4.
. . . . . . . . . . . . . . . . . . . . .
11.5.
. . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12. - . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.1. . . . . . . . . . . . . . . . . .
12.2. . . . . . . . . . . . . .
12.3.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.4. -
- . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12.5.
. . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

215
215
220
225
230
235
244
245
246
246
254
269
284
293
302
303


, ,
, .
, ,
.
,
.


.

,
(), , .

.
I. II . III
. IV
.
V.
, , ,
, ,
.
: , , ,
.
, 2007 .
. .



:


,
,
,
. , , ,
,
, - .

.
, , ,
, , . .

,

. ,
, ,

.
, ,
,
,

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

[.1, .2],
. 8402
, [.1].


,
. ,
,
[.1, .3],
:
-
. ,
, /
;
. , /
;
;

.

, [.1].
,

, :
:
, ;
, : .
;
: ,
;
, :

, ,
;
: ,

, ;
: , .
,

. [.4] , , ,
.
. ,
, , [.4]
, .


.
, [.5] .
.
, , . , (,

10

) ,
. , [.5],
,
,
, , .
,
.
.
.
, - .
,
, /
. ,
, . .

.

, ,

.
,
, .
,
.
,
.
, .

, , ,
. ,
, ,
, . . [.1, .2]. .

11


, , ,
. ,
, , , .
,
,
. ,
,
. .
, ,
.
- .
, , .


/.

, .
.

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

.
,
-.
.
,

12


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

. . ,
RISC-.
, , ,
.
.
.


:
;
;
;
;
, ;
;
;
.
,
.
.
, ,
[.6].

13

.
(0, 1)-
. ,
, .

,
.
-
, , .
.
, ,
,
. , ,
,

[.7].
,
;
.
.
,
,
.
, ,
. , ,
,
[.7, .8]. , , , ,
, . ,


.

. , ,

. , , .
. ,

14

, .

. ,
,

,

, .
.
.
.
[.9]
.

. , ,
,

.
,
( ),
, . ,
, ,
[.10].

.

.
, :

, ,
. ,
PSPACE, [.11];

;
;

, .
,
;

15



, ,
;
,
;

;


;


.
.
,
, , , .
,
,
, .

,
, .

.
.

.

, , ,
.
- .

.

16


.1. . . . .: , 2003. 520 . (
).
.2. . . . .:
, 2001. 384 .
.3. . .
28195-89.
.4. . ., . . // , : XI
- . .: , 2002. . 352353.
.5. . . // . . 12. .: , 2002. . 170188.
.6. . ., . . : . .
3- ., . . .: . ., 2001. 343 .
.7. ., ., . :
. . .: , 2001. 384 .
.8. . : . . 2- ., .
.: , 2001. 352 .
.9. . ., . . . .: ,
1991. 231 .
.10. . .
// . 2003. 2. . 3340.
.11. ., ., . ,
: . . 2- . .: , 2002.
528 .

,

- . ,

,
, ,
.

1

, ,
. , ,
.
1930-
(, , ) [1.1, 1.2], 1950-
, , ,
, .
, ,
[1.3].

. 1950-
. 196070-
:
2 . .

18

. 1.


, ,
. .;
, , , P = NP,
NP- ;

,
,
, , , ;

, (
, , . [1.4]).
,
.

, , , .

1.1.
.

- (, , ;
. 783850). algorismi. ,
,
.
. , ,
.

, . , , . .

1.1.

19

. ,
,
()
.
,
.
, . ,
, . . [1.5] . . [1.6].
1.1 (. . ).
, ,
-
.
1.2 (. . ). , , .
,
, , .

, , ,

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

30- , , ,
:
.
2*

20

. 1.

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


. , ,
,
. ,

.
,
, . .
Z Z .
. . , ,
.
, , .
, , ,
.
, ,
.
.
?

,
, , -
, ,
.

1.1.

21

,
,

. , . [1.3];

.
. , ,
(Emil Post) , 1,
1936 . [1.1]. , , ,
. ,
3x + 9 = 0 , ax + b = 0 ;
, . . .
, . ,
.
, , , . .
, , .

(),
, . 1.1.

. 1.1. .

( ), , , .

, .
, ,
; , 1936 .
.
,
:
1) , ;
2) , ;
3) 1 ;
4) 1 ;

22

. 1.

5) , ,
;
6) .
,
. ,
.
, . ,
,

.
. :
,
1 2, . .
;
, 6;
1-, ;
1- 1- ( 1-),
, ,
.
. , .
[1.7] ,
(0 = ; 1 = ; 2 = ), . .
,
.
, , , ( ) N
. 1-, 1-, ,
n N ,
n-
.
1- 1-, ,
, 1
. .
. (. [1.7]):
, . ,
, ,

1.1.

23

, .
. , ,
1.
. . . .

,
.
, ,
,
, 1 (. . 1.2).

. 1.2. .

, ,
, ,
, 1;
, , ,
,
, [1.7].
. (Alan Turing) 1936 . [1.2],

.

1900 . .

,
.

. ,
.
,
[1.8]: , .
, . .
, , , ,

24

. 1.

. , , , ,
.
,
()
[1.9].
. :
Q,
;
;
( , ), Q (
qi i )
Q {L, R} ( qj , i j
):
Q Q {L, R};
,
;
e ;
q0 Q,
.

si , ,
. 1.3.
,
,
,
.
, (qi , i )
.

. 1.3. .

. ,
.
. , , ()
. ,

1.1.

25

,
, , ,
,
.
. .
- ,
?
,
,
.
XIX
, . :
.
1900 . , . , ,
. : .
, .
.
, , .
.
. . 1952 .
,
1912 ., 1970 .
. . 10-
.
: 10. .
. ,
,
.
,
, , [1.9].
1.1. ( ),

,
.

26

. 1.

, ,
,
, ,
.

.
1.1. [1.7].
f(n) = i, n
, i n . 3,141592 . . . ,
f(1) = 5. f(n)
n.
, ,
, . f(n)
, ,
n .
f(n), n (
), n.
1.2. [1.10].
, , : 28 = 1 + 2 + 4 + 7 + 14. S(n), n- ,
S(n) n. , , ,
, .

. m n-
, ?
1.3.
[1.7].

()
,
. . ,
, :

m
, - ?
/
, . .

1.1.

27


.
1.4. [1.9].
, ,
, ,
.
1.5. [1.9].
,
.
1.6. [1.10].
,
[5]. , , ,
,
.
. : || 2 ( ,
, )
+ + , . .
: (x1 , y1 ), . . . , (xm , ym ).
, ,
, , ,
, (, ),
.
= {a, b} .
1. : (abbb, b), (a, aab), (ba, b).

(a, aab), (a, aab), (ba, b), (abbb, b),
a a ba abbb = aab aab b b.
2. : (ab, aba), (aba, baa), (baa, aa).
, - (aba, baa)
(baa, aa), (ab, aba),
a, . .
a .
,
; , ,
.
,
.
, . .
, , -

28

. 1.

,
.
,
,
, , , ,
, . ,
,
.
. DZ
() Z, R
; , DZ R.
, ,
d DZ ,
,
d DZ .
.
.
,
. .
,
.
, ,
. ,
, , .,
,
.
,
.
: ,
.

.

NP- .



,
.

1.2.

29

: , ,
:

;
,
, , ;
.
,
, :

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

1.2.
, , , .
. 1.1 [1.11]:
:
.
,
. ,
;
, :
, . . -

30

. 1.

,
.
, ;
: ,
, ;
:
,
;
:
;
: ,
;
: , ,
;
: ,
, ,
;
: ,
.
.
[1.11], .
1. , .
,
.
.

, .
.
(). , ,
, .

: , , .
2. .
.
( . [1.7]).

, , ,
,
.

1.2.

31

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

, .
(. 2.4).
4. .
. , ,
, .
5. .
,
, ,
.
6. .
, .
.
, .
.
7.
?
8.
?
9. ?
, ,
. ,
, ,
, :
, ,
.
,
, ,
. . ,
, , ,

32

. 1.

. . , , .
, . .
,
:

?
()
.

1.3.
, .
,
.

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

:
;
.
[1.12]. A
Z.
Z,
A ,
Z . -
. , A Z.
, Z A.

1.3.

33

Z A fA (Z). ,
. A
, ,
fA (Z)
. [1.13],
.

, , .
( ) n,
n ,
, A Z
n [1.12], :
FA (n) = max{fA (Z) | Z n}.
Z


, , ,
n. FA (n),
,
.
, ,
.
, ,
Z , .
,

,
, , , ,
.
A .
(
/),
, .
() , , ,
.
3 . .

34

. 1.

m Z,
VA (Z) = max{VA (i) | i = 0, m},
i

VA (i) i- , VA (0) = n
.
A n
:
VA (n) = max{VA (Z) | Z n}.
Z

VA (n) ,
, ,
.
, , ,
, 3.1
.

1.4.
1960- 1970-
[1.141.16] ,
. .
(
) . [1.4]. ,

.
.
, , .
,
, .
,
.
,

( ,

1.4.

35

) [1.8], .

.

.

, .
.
, , , ,

.
, ,
,
f(n) g(n) n 1, .
1.1. ().
f(n) = (g(n)),
c1 > 0,

c2 > 0,

n0 > 0 : n > n0

c1 g(n) f(n) c2 g(n). (1.4.1)

, g(n) f(n), . . (1.4.1)


f(n) g(n)
n > n0 . f(n) = (1)
, f(n) n > n0 ( ,
). (g(n))
f(n),
(1.4.1).
1.2. O ( ).
, O , f(n) g(n) n > n0 ,
. , f(n) = O(g(n)),

c > 0, n0 > 0 : n > n0 0 f(n) cg(n).


(1.4.2)
, O(g(n))
f(n), , , g(n)
(1.4.2),
3*

36

. 1.

, g(n) f(n).
, :
f1 (n) = 12,

f2 (n) = 5n + 23,

f3 (n) = n ln n,

f4 (n) = 7n2 + 12n 34

O(n2 ). O
, , , f(n) = 12n3
O(2n ), .
1.3. ().
O, , . .
, , g(n) :
f(n) = (g(n)),
c > 0,

n0 > 0 : n > n0

0 cg(n) f(n).

(1.4.3)

, (n ln n) ,
, g(n) = n ln n; , ,
.
O
; , . [1.17]. ,
: ,
f(n) = n1+sin n ,

g(n) = n

.
P ,
- . 1960- ,

, .
?
(Alan Cobham, 1964), (Jack Edmonds,
1965) [1.18], P.
, . . P,
k ,
O(nk ), n . ,
P
,
n. , P ,
.
:
P k
6,
;

1.4.

37

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

.
NP - .
, .
: , ?
. n
, A = {a1 , . . . , an }, V.
, X = {x1 , . . . , xn }, xi {0, 1},
,
n
X

ak xk = V.

(1.4.4)

k=1

: V
A. - X,

,
(1.4.4) (n) .
, , .
D, |D| = n, S, , |S| = O(nl ), l
, AS = AS (D, S), , 1,
, 0, . NP,
m, AS
O(nm ) [1.18]. NP,
, , . ,
NP, ,
, P. NP
.
P = NP. , , (Edmonds, 1965) [1.18]
: P = NP?,
.
: ,
,

38

. 1.

? , , P, NP, . .
,
.
P NP, .
, P
NP, . . NP\P ,
. 1.4.
, , NPC, NP-
.

. 1.4. P NP.

NPC, NP- . NP-


(Stephen Cook, 1971) [1.15]
(1973) [1.19] . :
Z1 ,
, Z2 , ()
Z2 Z1 ,
Z2 Z1 .

: Z1 DZ1 ,
Z2 DZ2 ; fs ,
,
dZ2 DZ2 Z2 dZ1 DZ1
Z1 , . .
dZ2 DZ2

fs (dZ2 DZ2 ) = dZ1 DZ1 ,

Z2 Z1 .
,
fs , O(nk ), n ,
dZ2 , k , . . P, , Z2
Z1 [1.2]. ,
; Z1

1.4.

39

L1 , Z2 L2 ,
, , :
L2 p L1 .
NPC (NP-Complete), NP-
:
-, L NP (L NP);
-,
NP ( Lx NP Lx p L),
. 1.5.

. 1.5. NPC.

NPC :
, NPC, , P NP, . . P = NP [1.18].
NP NPC
( ).
NP- [1.20], . ,
[1.18].
, ,
. 1.6, , P = NP, . . NP\P = , NPC
, , .

. 1.6. P, NP, NPC.

NP-
( ). -

40

. 1.

(Richard Karp)
NP- .
NP-
[1.20]; ,
NP- . , , ,
, [1.8].


1.1. Post E. L. Finite Combinatory Processes Formulation 1 // J. Symbolic
Logic (1936) 1, pp. 103105.
1.2. Turing A. M. On Computable Numbers, with an Application to the
Entsheidungsproblem // Proc. London Math. Soc. (1937) 42, Ser. 2,
pp. 230235.
1.3. . . : . . .: ,
2004. 160 .
1.4. . . . . 1. : .
. 3- . .: , 2002. 720 .
1.5. . ., . . //
. . 1958. . 13. 4. . 328.
1.6. . . // .
. . . 42. ., 1954.
1.7. . . . .: , 1979. 96 .
1.8. ., ., . ,
: . . 2- . .: , 2002.
528 .
1.9. . . . .: , 2002. 224 .
1.10. ., . , . 2 . . 1. : . .: .: ,
1978. 612 .
1.11. . .
(http://intsys.msu.ru/staff/vnosov/theoralg.htm).
1.12. . . (http://www.edu.yar.ru/
russian/pedbank/sor_prof/bondarenko/chast1.html).
1.13. . : . 2- .,
. .: , 2004. 368 .
1.14. Cobham A. The intrinsic computational difficulty of functions // Proc.
Congress for Logic, Mathematics, and the Philosophy of Science. North
Holland, Amsterdam, 1964. pp. 2430.
1.15. Cook S. C. The complexity of theoremproving procedures // Third ACM
Symposium on Theory of Computing. ACM, New York, 1971, pp. 151158.
1.16. Karp R. M. Reducibility among combinatorial problems // Complexity of
Computer Computations / R. E. Miller, ed. Plenum Press, New York,
1972, pp. 85104.

41

1.17. Knuth D. Big Omicron and Big Omega and Big Theta // SIGACT News 8(2)
(1976), pp. 1824.
1.18. ., ., ., . :
: . . 2- . .: , 2005. 1296 .
1.19. . . // . 1973. . 9. 3. . 115117.
1.20. ., . :
. . .: , 1982. 416 .

2



, .
.
,
.

2.1.
. , 1.2.
. ,
:
, ,
, ,
. ,
,
{0, 1};

, .

;
, ,
. ,
;
,
,
. , ,

2.1.

43

, ,
, ,
, .
, ,
, .
, , ,
.
, - ,
.
, [2.1].
- .
,
,
.
,
,
, , -
. , ,
.
- IA
,


= {s1 , . . . sn1 , e},
e = sn .

A, ,
k Z

ak ak+1 : A = (. . . ak1 , ak , ak+1 . . . ),

Z , A
. ,
, A .
I A:
I A,

44

. 2.

Ik I
Ik = (s , ak A) = (s, ak ),

k Z;

a, b (a, b),
{a, {a, b}}. ,
,

a A s : (s, a) I,
a A (si , a) I & (sj , a) I i = j.
:
s = {s },

a = {a A},

|s | = 1,

|a | = 1,

= s a = (s, a) J
J = I ;

k Z

Jk = (Ik , ) = ((s, ak ), (s, a)).

Z J:
Z = {S(si ), A(ai ), N(al ), P(al ), R(al ), W(al )},
, ,
s = {sm },

a = {al },

. . = s a = (sm , al ),

S(si )
S(si ) : k Z

((s, ak ), (sm , al )) ((s, ak ), (si , al )),

A(ai )
A(ai ) : k Z

((s, ak ), (sm , al )) ((s, ak ), (sm , ai )),

N(al )
N(al ) : k Z ((s, ak ), (sm , al )) ((s, ak ), (sm , al+1 )),
P(al )
P(al ) : k Z

((s, ak ), (sm , al )) ((s, ak ), (sm , al1 )),

R(al )

((s, ak ), (sm , al )) ((s, ak ), (sm , al )),
R(al ) : k Z
((sj , ak ), (sm , al )) ((sj , ak ), (sj , al )),

k = l
,
k=l

45

2.1.

W(al )

((s, ak ), (sm , al )) ((s, ak ), (sm , al )),
W(al ) : k Z
((sj , ak ), (sm , al )) ((sm , ak ), (sm , al )),

k = l
.
k=l

s = {si } si
,
, s , a , A . ,
. [2.2], -, s , a :

s = si , si : s = {si }
.
a = ai A, ai : a = {ai }
- , ,
R(a ) , a = {al }, R al : R(a ) R(al ). , , a = {al }, N(al ), P(al ),
R(al ), W(al )  .
, IA = J, Z ,
.

.
.
MC , [2.3], MC

MC = IA , P,
IA = J, Z ; P
.

P = R, C, ,
R , , ,
[2.2]; C ,

C = CI CD CP {stop},
CI , Z
IA - ; CD

46

. 2.

; CP

. stop
.

,
.
= {, }, , ,
0 1. ,
, .
, 1. ,

( , C).
- , ,
:  = 1  = 1,
. , , , , . , . [2.4], , a, b

0, a = b
.
[a = b] =
1, a = b

,

(, = {[s Q sj ]}),

Q {=, =, <, , >, };

,  = 1, , ,
Q = , s , IA , sj ,
= {1}.
.
. = {, e},
. ,

1 .

2.1.

47

@,
, .
1. 1 . ,
a ,
(, P(a )).
2. , , .
, 17, 14 (
):
(, R(a ));
s
(, = {[s = ]});
(, @17);
17
(, @14).
3. , .
s
(, R(a ));
(, = {[s = e]);
(, stop);

(, S(e));


(, W(a )
, , .
.
,
.
. ,
, , - [2.5]. () D ,
.
[2.6]:
v, (
), fv = fv1 op fv2 , fv = fv1 op c,
fv = fv1 , v1 , v2 v D , op , c .
v, (
), fv1 > 0, fv1 < 0
fv1 = 0, v1 v D .

.

48

. 2.

, D Z, x X. D, C(D),
cost(x, D), x, cost(x, D) , . Z,
C(Z), C(D)
D, Z.
d. ,
f(x) > 0, f(x) < 0, f(x) = 0,
f(x) x d. d = 1
, [2.7].

. . [2.8].
. , [2.6].
[2.6] .
 = F, G, ,
F , X, G ,
X. Y.
, , .
.
( [2.6]).
G;
.


{1, 2, . . . , }. , .
F .
Y,
.
 = F, G.
[35]
.
, , [2.9].

2.2.

49

2.2.
(RAM)
.

[2.10].

. , .
[2.11] MIX.
.

:
, , {0, 1},
;
. ,
,
. 0
;

,
, ,
.
,
0;

(. . ) ,
MIX [2.11], . . . , . , (
)
;
,
, .
. ,
, :
;
;
;
;
4 . .

50

. 2.

;
.
. :
, . . , ;
, . .
, ;
, . .
, .
,
, [2.9].

, .

,
(RAM- ),
, ( 28195).

2.3.
: , ,
, ()

.
, ,
,
. [2.12]
.
.
,
2.1 :
,
, DA ,
DP , DR :
= DA DP DR ;
,
( ), R;

2.3.

51

R C, R
.

,
.
2.1. BR
[2.12] , , :
BR = , R, C.
, ,
.
, , , , R,
. ,
:
R, S,
C
. ,
C . , +
add. .

;

,
(, , )
C, T. ,
.
, ,
[2.12].
2.2. BA
BR , S
T:
BA = S, T.
4*

52

. 2.

,
, () ,

.
.

. ( ), .
,
O(1)
.
2.3. , O(1)- ,

s S : s = C Ck , k : k 1, k = O(1);
t T : t = C Ck ,

k : k 1,

k = O(1).

O(1)- , ,
.

, R, C
S, T ,
.

2.4.


. , , .

; ,
.

.

2.4.

53


.
, ,

. , -
.
,
,
.
.
:
: a b;
: a[i] : (a) + i ( );
: {, /, , +};
: a{<, >, =, , }b;
: (l1){or, and, not}(l2);
(-)
(name1.name2).
,
S = {si }, i = 1, k, :
,
,

.
;

;



;
, . . .
, O(1)- .
.

. ,
-

54

. 2.

. ,
, ,
.

, ,
. ,
. ,
,
,
.
,
,
, , .
.
1. <>. ,
.
2. <>. ,
,
.

.
, ()
,
. ,
,

,
() . , .
, . .
;
,
.
. 2.1
, ,
().
. -

2.4.

55

. 2.1. .

, ,
,
.

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

. ,
, .
,

56

. 2.

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

. 2.2. .

1. ,
, ,
.
2.
. ,

2.4.

57

.
.
3. ,
,
.
4. ,
, , ,
, .
5. 4 ,
.
6. , ,
,
.
4. . ,
, .
,
. ,
,
, , ,
,

.
;
,
, , .
,
.
.
,
,
.
.
, , , -

58

. 2.

, .

-.
,
,
.

, , ,
, Delphi .
, , - .


2.1. . ., . ., . .

// . .: . . . 2006. 3.
. 114123.
2.2. . ., . ., . . . . . : , 1978. 318 .
2.3. . ., . . : .
/ . . . , . . . .: . ,
2001. 744 .
2.4. ., ., . .
: . . .: , 2006. 703 .
2.5. Ben-Or M. Lower bounds for algebraic computation trees // Proc. 15th ACM
Annu. Symp. Theory Comput. Apr. 1983, pp. 8086.
2.6. . ., . . .
.: , 2002. 288 .
2.7. Steele L. M., Yao A. C. Lower bounds for algebraic decision trees //
J. Algorith. 1982, 3, pp. 18.
2.8. . . // . . 1998. . 358.
1. . 2632.
2.9. . ., . . . .
: . .: - ; . , 2006. 320 .
2.10. ., ., . : . . .: , 1979. 546 .
2.11. . . . . 1. : .
. 3- . .: , 2002. 720 .
2.12. .. . .: -
, 2004. 212 .

II


, ,
,
. ,

. ,
.
-
. ,

.


:
,
;

, , ;
:
,
,
, ;

, , , ,

60

. 3.

;

;
,

.
.

3



, , .

.
. ,
.

3.1.

, / .
[3.1, 3.2],
,
. , ,

. [3.3], [3.4].

3.1. 61

.
. , ,
,
.
,
.
, ,
, , . .
.
3.1. .
DA ,
A, D DA
( A) n. D
n di ,
{0, 1}:
D = {di , i = 1, n},

|D| = n.

A D
, . fA (D)
A D. ,
D
( ,
A 1- [3.5]).
,
- D n,
n = |D|,
. n
( ) DA , , n, Dn :
Dn = {D | |D| = n}.
di {0, 1}, Dn
M, . . M = |Dn |. A, D Dn , , , -
, - . ,
.
, ,
.

62

. 3.

fA (n). , A
n, . . D Dn :
fA (n) = max{fA (D)};
DDn

fA (n)


, , A
n:
fA (n) = min {fA (D)}.
DDn

fA (n)
, . . ,
A n:
fA (n) =

p(D) fA (D),

DDn

p(D) D ( Dn ) . ,
D Dn ,
fA (n) =

1 X
fA (D).
M
DDn

, fA (n) .
, fA (n).

. , , .
3.2.
(
).

, O ,
: fA (n) = O(g(n))
fA (n) = (g(n)), g(n) , O
fA (n).
, fA (n) O (fA (n) fA (n)),
. . , O(g(n)) , g(n)
, ,
fA (n) fA (n) fA (n).

3.1. 63

.
( ) ,
. , , ,
( ),
.
. ,
.
3.3. .
, A ,
D,
, .
D VA (D). VA (D) .
, ,
,
n: VA (n), VA (n), VA (n).
.
3.4. .

, O ,
: VA (n) = O(h(n))
VA (n) = (h(n)), h(n) , O
VA (n).
.
,
,
n.

, ,
, , ,
.
3.5. .
,


.
(Resource characteristic) ch (A):
ch (A) = fA (n), VA (n),

{ , , }.

64

. 3.

3.6. .
(Resource complexity) ,
,
O ,
 (A):
 (A) = O(g(n)), O(h(n)),

g(n) : fA (n) = O(g(n)),

h(n) : VA (n) = O(h(n)),

 (A) = (g1(n)), (h1(n)),

:
g1(n) : fA (n) = (g1(n)),

h1(n) : VA (n) = (h1(n)),

{ , , }.

, ,
,
, ,
. . . , .

, fA (n) = (n2 ) [3.2],
2
. 
(A) = (n ), (1).

3.2.


. DA
(. 3.1). , , , DA
[3.3]:
Vexe (DA ) , , . EXE-, . , , ,

, (

3.2.

65

[3.1]).
DA .
, ,
.

, .
, .
;
Vram (DA ) , ,
.
, . .
.
[3.1, 3.6].
[3.2],
,
( ). : (n) ,
n ;
Vst (DA ) ,
. ,
.
, .
- ,

, ;
T(DA )
.

. t
. ,
,
;
5 . .

66

. 3.

fA (n).
f A (n). t

. 3.4.
. ,
. ,
D
A (D) = CV VA (D) + Cf fA (D)

(3.2.1)


(R)
A (D) = Cexe Vexe (D) + Cram Vram (D) + Cst Vst (D) + CT TA (D), (3.2.2)
Ci , i {V, f, exe, ram, st, T}
, .
(. . , ) Ar
Ci
(R)
A (D),
A. A m A = {Ai | i = 1, m},
(R)
Ai (D) : (R)
Ai (D) = min {Ai (D)},

(3.2.3)

i=1,m

Ai (D)
. (3.2.3)
D DA ,
,
,
. - D.

, .
3.1,
A (n) = CV VA (n) + Cf fA (n),

(3.2.4)

{ , , } ,
,
(R)
A (n) = Cexe Vexe (n) + Cram Vram (n) + Cst Vst (n) + CT TA (n). (3.2.5)

3.2.

67

R(n), i ,
R(n) = i :

i {1, m};

i = arg min {(R)


Ai (n)}.

(3.2.6)

i=1,m

[n1 , n2 ]
:
R(n) [n1 , n2 ]:
ni , nj [n1 , n2 ] : R(ni ) = R(nj ) = k,
k
(3.2.5) [n1 , n2 ];
R(n) [n1 , n2 ]:
ni , nj [n1 , n2 ] : R(ni ) = R(nj ),
, , (3.2.5)
[n1 , n2 ]. [n1 , n2 ]
, R(ni ) = const, .
, ,
.


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

n
X(n) = (Vexe (n), Vram (n), Vst (n), T(n)),

. ,
T(n). n ,
. , ,
n,
X(n), W.

5*

68

. 3.

( , ) . ,

. W (
T(n))
.
, .
W
, ,
V(n) = Vexe (n) + Vram (n) + Vst (n).
V T . ,
,
W = {(0, T ) (0, V )}
W. n1 , n2 , n3 , n4
, n1 < n2 < n3 < n4 .
. 3.1
W.
P1 P2 ,
P1 , P2 .

. 3.1.
.

,
. . 3.1 , n3 P1
( W) ,
n2 P2
W .

3.3.

69

3.3.

.
, . ,
,
.
, ,


. ,
,
,
, .
.
.
, , ,
, .
NP- .

[3.2], , - NP- .

.
. ,
, , , ,
, .
, , T(n)
, : T = T(n, ).
,
, -
. ,

, :
(R)
(R)
A = A (n, ).

70

. 3.

= 0 .

:







E n, 0 = T n, 0 + V,ram n, 0 ,

T , V,ram
. = 0 (R)
A (n, 0 ),


0
(R)
, < 0 .
(R)
(n,
)
=

(n,

)
+
E
n,
0
A
A

. , .

.

,
,
. ,

. , . . , ,
.
,
.
[3.4] . 4. , [3.4],

i (n) ,
C i (n).
C .
.
-

3.3.

71

,

.
, ,
. ,
,
, ,
Cram = Cram (Vram (n)).
,
.
H(t),
x H(x):
x

H(x) =

(x) dx,

(x) -. , . , ,
. 3.2.

. 3.2. Cram , .

. 3.2
V1 V2 , , L1
L2 - . k Cram , Cram, j j j 1. , Cram, 0 = 0,

Cram (n) =

k
X
j=1

Cram, j H(Vram (n) Vram, j1 ),

72

. 3.

Vram,j1 ,
Vram, 0 = 0. , .

3.4.




.
. - ,
, .


.
- , .

.
(. ISO 14756 [3.7])
/ :
TA (n) = TA (fA (n), r1 , r2 , . . . , rk ),

(3.4.1)

: TA (n) ,

; fA (n) ; ri , i = 1, k; k n ,
.
TA (n) , ( , , ,
), .
:
, , ,
,
[3.8];
, , -

3.4.

73

, , ,
, (-),
. . [3.9];
,
. ,
RISC-,
[3.9];

,

[3.9];
,
. ,
,
;
,
, , ,
;

,
, ,
, ,
, , ,
. .
,

.
. ,

.
, , , , - ,
-
.

: -
;

;
.

74

. 3.

.
, .

t ,

TA (n) = fA (n) t.
, t
, , ,



. , ,
,
, .
.

si
.
:
f A,si (n)

. ,
;
tsi

;
,

:
T A (n) =

k
X

tsi fA,si (n),

(3.4.2)

i=1

: k ; fA,si (n)
si , i = 1, k; tsi
si .
, . , , ,

3.4.

75

,
.
, , , ,
- .


.
10.


.

.
[3.10] :

; fA (n)
;
;
ni , i = 1, m,
n , j = 1, n , ,
tj (ni )
t (ni ) =

n
1 X

t,j (ni );
n

(3.4.3)

j=1

: fA (ni )
,
, ,
t(ni ), t :
t(ni ) =

t (ni )
,
fA (ni )

t =

m
1 X
t(ni ),
m

(3.4.4)

i=1

m ;
: , ,
:
TA (n) = t fA (n),

n
/ ni ,

i = 1, m.

(3.4.5)

, (-

76

. 3.

: , Windows 98, ASUS COUPLE-VM, PIII-633 ).


. n = 106 . . 3.1. : tsum
; t (ni )
; t(ni )
.
3.1
i

ni

50

fA (n)

tsum

t (ni )

t(ni )

t
6 815

17,51

0,00001751

2,5705

60

9 680

24,45

0,00002445

2,5266

70

13 045

32,52

0,00003252

2,4935

80

16 910

41,80

0,00004180

2,4723

90

21 275

52,30

0,00005230

2,4586

100

26 140

63,88

0,00006388

2,4440

200

102 290

244,90

0,00024490

2,3942

2,4800

n = 300, 400

300

228 440

0,00056652

0,00054330

4,274 %

400

404 590

0,00100337

0,00095690

4,856 %

t(ni ) ;
(. 3.1) , .
. , [3.10],

t(n).
t , ,
n .
,
,
, , fA (n). , ,
,

.

3.4.

77

,
, ,
fA (n) =

k
X

fi (n),

f0 (n) = const,

(3.4.6)

i=0

k . fi (n) :
fi (n)  fi1 (n),

i = 1, k;

(3.4.7)

, fk (n)
, fi (n):
(fA (n)) = (fk (n)).
fA (n)
fk (n),
,
fA (n) , ,
. ,
(nmin n nmax )

fk2 (nmin )  fk1 (nmin ),



fA (n), , fk (n) fk1 (n).
ti i- ,

k
X

t(n) =

ti
i=0
k
X

fi (n)

,
fi (n)

fA (n) =

k
X

fi (n).

(3.4.8)

i=0

i=0

, , ti , (
n).
k- (k 1)-
t( n)

(tk fk (n) + tk1 fk1 (n))


,
(fk (n) + fk1 (n))

, tk ,

fk (n)
t(n) tk

t
fk (n)
+ k1
.
tk
fk (n) + fk1 (n)
fk (n) + fk1 (n)

(3.4.9)

78

. 3.




. , (3.4.8) (3.4.7) ,
lim t(n) = tk ,

, , t(n)
n.
, t(n)
. , ,
(3.4.6).

.

fA (n) = a2 n2 + a1 n + a0 ,

k = 2.

, , a1 nmin  a0 , , , a0 . ti

:
tA (n) = t2 a2 n2 + t1 a1 n,
:
=

t1
,
t2

t1 = t2 ,

a1
,
a2

a1 = a2 ;

tA (n) = t2 a2 n2 + t2 a1 n = t2 a2 n (n + ),
fA (n) = a2 n2 + a1 n = a2 n2 + a2 n = a2 n (n + ).
(3.4.8), (3.4.9)

t(n) = t2

n +
;
n+

(3.4.10)

, lim t(n) = t2 . t(n)


n
:




n + +

( 1)
= t2 1 +
;
t(n) = t2
= t2 1 +
n+

n+

n+

3.4.

79

> 1, . .
, , , t(n) n, t2 . < 1,
t(n) n,
t2 , . 3.3.

. 3.3. t(n) .

t2
. ,
, ,

{ni }, {tA (ni )}, i = 1, m
.

tA (n), [3.11]
t2 .
1. tA (n)
tA (n) = t2 + t2 ( 1)

1
.
n+

:
x=

1
,
n+

y = tA (n);

-. ,
, , x ni . b t2 , k
t2 ( 1), y = k x + b.
,
k b . t2 = b ,

80

. 3.

k
.
b

= 1 +

2.
tA (n) (3.4.10):
n +
;
n+

tA (n) = t2
, ,

ln tA (n) = ln t2 + ln(n + ) ln(n + );





n+ =n 1+
,
n




n+ =n 1+
,
n






ln t(n) = ln t2 + ln n + ln 1 +
ln n ln 1 +
.
n

, ,

1
,
n2

ln(1 + x) x 0: ln(1 + x) x + O(x2 ), :


ln t(n) = ln t2 +

= ln t2 + ( 1).
n
n
n


x=

,
n

y = ln t(n),

-
y = k x + b,

b = ln t2 ,

k = 1.

k b , t2 = eb
= k + 1. ,

1
n2

.
, k-
, ,
( . [3.10]).

3.4.

81

. . . 3.4
t(n),
(3.4.10) . . 3.2

. 3.4. t(n)
( ).

,
.

.
6 . .

82

. 3.
3.2
i

ni

fA (n)

t (ni )

tsum

t(ni )

50

6 812

17,51

0,00001751

2
3

60

9 677

24,45

0,00002445

2,5266

70

13 042

32,52

0,00003252

2,4935

80

16 907

41,80

0,00004180

2,4723

90

21 272

52,30

0,00005230

2,4586

100

26 137

63,88

0,00006388

2,4440

200

102 287

244,90

0,00024490

2,3942

2,5705

1
= 4,60 t2 = 2,321930 = 2,232515
8
9

300

228 437

0,00054029

0,00054330

0,554 %

400

404 587

0,00095259

0,00095690

0,451 %

2
= 4,60 t2 = 2,333001 = 2,034124

10

300

228 437

0,00054127

0,00054330

0,374 %

11

400

404 587

0,00095500

0,00095690

0,199 %

, . 3.2, ,

.


3.1. ., ., . :
. . .: , 2001. 384 .
3.2. ., ., ., . :
: . . 2- . .: , 2005. 1296 .
3.3. . . . .: -
, 2004. 212 .
3.4. . ., . . .
.: , 2006. 296 .
3.5. . . . .: , 1979. 96 .
3.6. . : . . 2- ., .
.: , 2001. 352 .

83

3.7. 9000. . 1,
2, 3. .: , 1998.
3.8. ., . :
. . .: , 1993. 400 .
3.9. .
: . . 5- . .: , 2002. 896 .
3.10. . .
// . 2004. 5. . 5462.
3.11. . ., . . : . .
3- ., . . .: . ., 2001. 343 .

6*

4



,
.

,
.

,
.

, , / .
,
, .
, , ,
.
,
, , .
,
, ,
[4.1]. ,
, ( )

. ,
, ,
, P EXP, [4.1, 4.2].
,

4.1.

85

. ,
.
, ,
.
,

, .

4.1.

,

. .

[4.3, 4.4].
,
,
.

,
,

. ,
P EXP [4.1, 4.2]
.
. Z. , . [4.5], DZ
Z. : RZ
, v . D DZ .
AZ (
, ),
Z 1- ,
. . A AZ D DZ
:
AZ = {A | A : D R, D DZ , R RZ , v(D, R) = true, fA (D) = D DZ },

86

. 4.

fA (D) D.
(
) DZ , ,
n, D(n)
Z :
D(n)
Z = {D | D DZ , |D| = n}.
, - [4.6]:
f(x) g(x)

lim

f(x)
= 0.
g(x)


fth lim (n)
- ,
, , ,
,
fth lim (n). ,
,
n ,
fth lim (n),
,
( ), .
, g(n)  fth lim (n)
.
fth lim (n) [4.7]. Flim , flim :
Flim = {flim | A AZ , n > 0, fA (n) = (flim (n))},
fA (n)
, n, . . D D(n)
Z ,
fth lim (n) = sup {Flim }.

. ,
, ,
, (log2 (n!)) [4.8].
n!,
fth lim (n) = (log2 (n!)) = (n log2 n n log2 e + 0,5 log2 (2n)) =
= (n (log2 n log2 e) + 0,5 log2 n + 0,5 log2 (2)).
. ,
,
-

87

4.1.

. ,
, :
(n),
, :
, , ;
(1) : , ,
.
ftr (n) [4.7] , ftr (n) Z,
fth lim (n) ftr (n):
fth lim (n) Z ftr (n);
fth lim (n) , ftr (n) fth lim (n),
ftr (n) = fth lim (n).
. , Z,
AR . , AR AZ ; , AR
. ,
Amin [4.7]. , ,
, , ,
-
. , [4.9]
[4.2], ,

. ,
AR
-.
AM = {Am } AR ,
,
AM :
AM = {Am | A AR : fA (n) fAm (n)},

|AM | 1;

Amin AM .

fAmin (n).

.
fth lim (n), , ftr (n) fAmin (n), ,
[4.7].
THCL (Theoretical close). ,
fth lim (n) fAmin (n) = (fth lim (n)). ,

88

. 4.

( ) ,
. . , ,
, .

,
fA (n) = (fth lim (n)) A AZ fAmin (n) = (fth lim (n)).
:
: fth lim (n) = (n), fAmin (n) = (n); : fth lim (n) = (n log2 n),
fAmin (n) = (n log2 n) [4.8];
: fth lim (n) = (n ln n ln ln n),
fAmin (n) = (n ln n ln ln n) [4.2].
PROP (Practical open). ,
fth lim (n) fAmin (n)  fth lim (n). ,

.
PROP ,

, ,
.
THCL. ,

,
. , , , , ,

- [4.3, 4.4]; ,
.
THOP (Theoretical open). ,
fth lim (n) , fAmin (n)  ftr (n).

. THOP
[4.7] ,

fth lim (n), , ftr (n),
PROP, ,
THCL.

4.2.

89

, THOP . NPC (NP-


), , , , , [4.2].

, fAmin (n) = O(n2,34 ) [4.2],
, , ftr (n) = (n2 );
.

4.2.

. ,
. ,
, , ,
.
[4.9]. n ,
f = f(n) .
, , . .
f = f(x), x R, f(x) x = n.

g(x) = (ln x)ln x .
4.1. g(x) = (ln x)ln x
.
. , g(x) x :
f(x) = xk ,
x

f(x)= e ,

k > 0,

f(x) = o(g(x)),

(4.2.1)

> 0,

g(x) = o(f(x)).

(4.2.2)

: lim f(x) = , lim g(x) = lim


x

lim

ln f(x)
= 0,
ln g(x)

f(x)
= 0, . . f(x) = o(g(x)).
g(x)

(4.2.1) (4.2.2). :
lim

ln(xk )
k ln x
k
= lim
= lim
= 0;
ln x
x
x
ln
x

ln
ln
x
ln
ln
x
ln((ln x) )

90

. 4.

, xk = o((ln x)ln x ) k > 0;


lim

ln((ln x)ln x )
ln x ln ln x
= lim
= 0,
x
x
ln(ex )

, (ln x)ln x = o(ex ) > 0, .


[4.9]
.
f = f(x), lim f(x) = .
x


h(x) = ln f(x) + 1 +

x
.
ln f(x) + ln x

(4.2.3)

h(x) , .
4.1. f(x) = ex (1 + (x)), > 0, (x) = o(1),

(x) = o(1) x ; lim h (x) = + 1.
x

4.2. f(x) = xk (1+(x)), (x) = o(1),  (x) = o(1),


x  (x) = O(1) x ; lim h(x) =
x

k
.
k+1

h(x)
, ,
.
4.3. h(x), , lim h (x) =
x

= C > 0; h(x) z(s),


:

 
1

;
s = arctg
x

(4.2.4)
z(s) =

z = arctg 1 ;
h(x)

x
lim

(s0)

dz
1
= .
ds
C

4.3 . (z, s)
,
x , s 0 (0, 0),
.
z(s), (4.2.4) f(x) = x2
f(x) = ex , . 4.1.
(f(x)) ( )

f(x) : (f(x)) = 2 arctg R,

R = x
lim

(s0)

dz
,
ds

4.2.

91

. 4.1. z(s) f(x) = x2 f(x) = ex .

z(s) (4.2.4),
h(x) f(x) :

h(x) = ln f(x) + 1 +

x
.
ln f(x) + ln x

4.1, 4.2 4.3 , [4.9].


4.1 ( ). f = f(x),
lim f(x) = ; :
x

1) f(x) = ex (1 + (x)), > 0, (x) = O(1),  (x) = O(1)


x , /2 < (f(x)) < ;
2) f(x) = xk (1+(x)), (x) = o(1),  (x) = O(1), x  (x) = O(1)
x , 0 < (f(x)) < /2;
3) f(x) = (ln x)ln x , (f(x)) = /2.
.

,
.
(f(x)) , lim f(x) = ,
x
.
1) Fz : Fz = {f(x) | f(x) xk k > 0}.
f(x) Fz R, 4.3,
+, (f(x)) = 2 arctg(R) = 0 f(x) Fz , , (ln(x)) = 0.
2) Fp : Fp = {f(x) | k > 0 : f(x) = (xk )}.
4.2, ,

f(x) = (xk ) g(x), g(x) Fz . Fp
:
Fk = {f(x) | xk f(x) xk+ , k > 0, +0, x +}

92

. 4.


Fp = {f(x) | k > 0 : f(x) Fk };
f(x) Fp 4.2 4.3 R = (k + 1)/k,
k > 0, (f(x)) = 2 arctg((k + 1)/k); ,
0 < (f(x)) < /2. . 4.2.

. 4.2. (f(x)) f(x) = (xk ).

3) Fl : Fl = {f(x) | xk f(x) ex , k > 0,


> 0}. f(x) Fl R, 4.3, 1, (f(x)) = 2 arctg(1) = /2, ,
((ln x)ln x ) = /2.
4) Fe : Fe = {f(x) | > 0 : f(x) = (ex )}.
4.1, ,
f(x) = (ex ) g(x), g(x) {Fl Fp Fl },
Fe :

F = {f(x) | e()x f(x) e(+)x , > 0, +0, x +}

Fe = {f(x) | > 0 : f(x) F };
f(x) Fe 4.1 4.3 R = 1/(1 + ),
> 0, (f(x)) = 2 arctg(1/(1 + )); ,
/2 < (f(x)) < . . 4.3.
5) Ff : Ff = {f(x) | ex f(x), > 0}.
f(x) Ff R, 4.3, 0,
(f(x)) = 2 arctg(R) = , , (xx ) = .
,
(f(x)) :

(xk ) , /4, k = 2/2;

(ex ) , 3/4, = 2;
(f(x)) :
(x1/ ) + (ex ) = ,

(x) + (ex ) = .

4.2.

93

. 4.3. (f(x)) f(x) = (ex ).

.
(f(x)) (
). n A, fA (n) n x (f(x)), -
[4.9]:
1. 0 (-) , Fz
:
0 = {A | (fA (n)) = 0 fA (n) Fz }.
, ,
; ,
.
, ,
:
O(ln n) [4.2], (ln n) = 0.
2. P ( )
, Fp :
P = {A | 0 < (fA (n)) < /2 = 0 fA (n) Fp }.
,
; , . P
, P .

94

. 4.

3. L
, Fl :
L = {A | (fA (n)) = /2 fA (n) Fl }.
,
. ,
, ,
NP,
.
,
RSA. n
, ,
, [4.10],
1/3

fA (n) = eO(n

(ln n)2/3 )

(fA (n)) = /2. L


, (ln x)ln x
, 4.1.
4. E
, Fe :
E = {A | /2 < (fA (n)) < fA (n) Fe }.
, ;
. NP-
, , , ,
. . [4.2],
()
O(2n ), O(n 2n ), O(n2 2n ).
5. F
, Ff :
F = {A | (fA (n)) = fA (n) Ff }.
,
- . , (n!),
n! = (n + 1), (x) - ln((x + 1)) x ln x x,
n! en(ln n1) ; (ex(ln x1) ) = ,
F.
n

4.3.

95

(nn2 ) [4.6].
F
(Factorial) .

4.3.

,
( ) ( ),
.
, ,
. . [4.11].
.
.
,
3.1. fA (D) n,
D, , , fA (D)
, fn (n) gp (D) ( [4.11]);
fA (D) = fA (fn (n), gp (D)).
fA (D)
fn (n) gp (D) ,

fA (n, D) = fn (n) gp (D)

fA (n, D) = fn (n) + gp+ (D).

, , , ,
, , . , ,
, NPC [4.2].
Dn gp (D) gp+ (D).
g (n) g+ (n):
g (n) = max{gp (D)},
DDn

g+ (n) = max{gp+ (D)}.


DDn

,
.

96

. 4.

.
, , . , . , , .
,

. , ,
, ,
, , , .
Lc ()
.
n = const : D DA

|D| = n.

, . .
Ln .

D1 , D2 DA : |D1 | = |D2 |.

, , . .
Lc . ,

, .
, Lc , , .
, Lc
.
( , D),
,
. :
C () :
n = const,

k = const : D DA

|D| = n,

fA (D) = k.

. .

4.3.

97

PR , D:
n = const,

k = const : D DA

|D| = n,

fn (n) = const = c
fA (D) = c g(D).



. , ,
,
. ,
= fA (k),
xk : fA (D)
X
ex = (xn /n!), : fA (D) = fA (x, ).
PR Lc .
PR , . , ,
. , fA (D) ,
.
D, .

PR, m
. fA (D) = fA (m),
fA (m)
,
PR.
PRpl :
k = const : fA (m) = O(mk ).
PRpl ,
.

[4.12].
PRexp :
k = const : fA (m) = O(em ).
PRexp ,
.
[4.12].
7 . .

98

. 4.

Ln . , Ln ,
D. , Ln
Dn ,
n. :
C () :
k = const : n: Dn DA

D Dn

fA (D) = k.

, , .
, n . , n
.
n
[4.2],
(1) .
PR
. ,
,
D
, , :
Dn DA

D Dn

fn (n) = const = c

fA (n, D) = c g (n).

N
. ,
,
g+ (n) = 0

g (n) = 1

fA (D) = fn (n).

,
. . , , .
NPR -
. , . . ,
. :
fn (n) = const,
fA (D) = fn (n) g (n),

g (n) = const,

fA (D) = fn (n) + g+ (n).

,
,

4.3.

99

,
fA (D).
PR Ln .
, , .

PR Ln .
PRfix ,
D:
fn (n) = const = c

fA (D) = c g(D),

g(D) = g(p1 , . . . , pm ),

m .
,
. k n.

.
PRfloat ,
D:
fn (n) = const = c

fA (D) = c g(D),

g(D) = g(p1 , . . . , pm ),

m , , . ,
. . ,
.
, ,
.
NPR
. - ,
fA (D) = fn (n) g (n)
NPR [4.11].
NPRl - NPR:
g+ (n) = O(fn (n))

g (n) = (1).

,
, . ,
7*

100

. 4.

.
, , ,
. . , ,
, g+ (n) = (n),
n .
NPRe - NPR.
, g (n) , fn (n):
g (n) = (fn (n))

g+ (n) = (fn2 (n)).

( ) .
, ,
- .
, , ,
,
, g+ (n) = (n2 ),
fn (n) = (n).
NPRh -
NPR. , g (n) fn (n):
fn (n) = o(g (n)). ,
. , ,
NP- .
, , , -
fA (D).
,

,
.
NPR
. , , NPR [4.11]
gp (D) ,
gv (D) gs (D). ,
gp (D)
gp (D) = gv (D) + gs (D).
D Dn De
, {d1 , . . . , dm },
|De | = m, Dp {d1 , . . . , dm }; , |Dp | = m!.

4.3.

101

De1 , De2 Dp , D1 , D2 Dn ,
gs (D)
, fA (n, D1 ) = fA (n, D2 ) D1 , D2 Dn .
,
fA (n, D) = fA (n, p1 , . . . pm ),

m n,

pi D,

i = 1, m.

gv (D), gs (D) gp (D),


NPR:
NPRS :
gv (D) = o(gs (D)).
;
, . - .
,
.
NPRV , D:
gs (D) = o(gv (D)).
; .
( ),
, .
.
[4.2],

. , ,
NPRS .
, NPR:
NPR \(NPRS NPRV ) = .
, ,

,
. ,
, , [4.13].

102

. 4.

. 4.4. .

,
. 4.4.

4.4.

, , . ,
. ,

. ,
, , .

,
, .
. ,


.
, ,
.
fA (D). , ,
N, , , ,

4.4.

103


.
NPR
,
.


.

. ,

.
, , ; [4.14].
4.1.

.
.

, NPR, . 4.5.

. 4.5. - .


n, Dn , |Dn |. Dn ,
. , n
, |Dn | = 2n ,
.
,
.
. 4.5 . -

104

. 4.

,
Dn . - ,
: fA (n),
: fA (n),
.
( Dn ) fA , P(fA ) .
. 4.6.

. 4.6.
- .

, ,
X

P(fA ) = 1;


fA (n) =

fA P(fA ),


fA Dn : fA fA fA . ,
, ,
.

, ; ,
, . [4.15].
,
i (n),
,
.
, i (n)

4.4.

105

n.
D
. f , f(x), [4.14].
4.2. ,
x [a, b] f(x):
x: a x b

f(x) 0,

b

f(x)dx = 1,
a

2 (f(x)), f(x)

f(x) = q (x a) + p (x b),
p = q = 1/2, (x) -; 2 (f(x))
1/4 (a b)2 .
, 4.2 , 2 (fA (n)) , , . ,
,
:
M(fA (n)) =

fA (n) + fA (n)
,
2

max (fA (n)) =

fA (n) fA (n)
.
2

(4.4.1)


.
.
, R = fA (n) fA (n) [4.16]. , R max (fA (n))
.

() RN (n)
n
:
RN (n) =

fA (n) fA (n)
.
fA (n) + fA (n)

(4.4.2)

, : fA (n) fA (n),
0 RN (n) 1.
V, -

106

. 4.


[4.16]; V,
,
V(n) =

(fA (n))
,
M(fA (n))

0 V(n) 1,

(4.4.3)

(fA (n)) , , n. ,
(4.4.2) (4.4.3). (fA (n))
0 max (fA (n)), , [4.14],

i (n) = V(n) RN (n),

0 i (n) 1.

(4.4.4)


, .

. ,
.


, .

.
.
,
[4.16]:
, ,

(fA (n)) = max (fA (n)) =

fA (n) fA (n)
,
2

fA (n)  fA (n),

M(fA (n)) =

fA (n) = o(fA (n)),

fA (n) + fA (n)
,
2

RN (n) 1 n (4.4.2);
i (n) 1 n ;

4.4.

107

, RN (n) 1
n ; , [4.16]:
(fA (n)) =

fA (n) fA (n)

,
12

M(fA (n)) =

fA (n) fA (n)
,
6

M(fA (n)) =

fA (n) + fA (n)
;
2

, i (n) 2/ 12 0,57735 n ;
; ,
RN (n) 1 n , 6 fA (n),

(fA (n)) =

fA (n) + fA (n)
,
2

i (n) 2/6 0,33333 n ;


, RN (n) 1 n ,
2,5 % (1/40)
, . . 2 (fA (n)) 5 % .
2,5 %
p = 2 (1) 0,6826 [4.16],
(fA (n)) =

fA (n) fA (n)
,
40

M(fA (n)) =

fA (n) + fA (n)
;
2

i (n) 2/40 = 0,05 n ;



:
, ,
; i (n) = 0.
[4.17].
i1. ,
: i (n) = 0.

( N).
i2. ,
:
0 < i (n) < 0,05.
i3. , :
0,05 i (n) < 1/3.
i4. ,
:
1/3 i (n) 1,00.

108

. 4.

i (n) ,
,
, ,
. , . .
( ) . ,
i (n) ,

.
i (n) . ,
, (fA (n)). i (n)
,
, ,
. ,
i (n) , (fA (n)),
.

[4.16],
,
i (n).
, , ,
,
i (n). , , ,
,
, .
, ,
, .

.

4.5.

.

-

109

4.5.

.
.
4.2.
.
,
, .
, , ,
. fA (n), *
{ ,

}.

(4.5.1)

,
n (n), * (4.5.1). , ,
.
, .


.
,
,
fA (n), .
[4.17].
.
, fA (n)
fA (n + 1) = hA (n) fA (n).

fA (n)

fA (n

(4.5.2)

+ 1) fA (n),

lim f (n) = ,
n A
hA (n) 1; hA (n)
hA (n) = 1 + n (n), n (n) 0.
(4.5.3) (4.5.2) n (n),

(4.5.3)


,
:

n (n) =

fA (n + 1) fA (n)
.
fA (n)

(4.5.4)

110

. 4.

, fA (n)

fA (n + 1) = fA (n) + n (n) fA (n).

(4.5.5)

.
,
fA (n) , (4.5.4) :
n (n) =

d
(f (n))
ln fA (n) = A
.
dn
fA (n)

(4.5.6)


(4.5.6) :
(fA (n)) fA (n + 1) fA (n),
n (n) (4.5.4), .

NPR.
NPR, . , 4.3:
fn (n) ; g+ (n)
; g (n) .
NPRL g+ (n) = O(fn (n)).
, g+ (n) c fn (n);

n (n) =

fn (n + 1) + c fn (n + 1) fn (n) c fn (n)
f (n + 1) fn (n)
= n
. (4.5.7)
fn (n) + c fn (n)
fn (n)

, NPRL

.
NPRE g (n) = (fn (n)).
, g (n) = c fn (n);
fn (n + 1) cfn (n + 1) fn (n) cfn (n)
=
fn (n) cfn (n)

f (n + 1) fn (n) fn (n + 1) + fn (n)
f (n + 1)
= n

= fn (n) 1 + n
,
fn (n)
fn (n)
fn (n)

n (n) =

(4.5.8)

fn (n)
. ,

4.5.

111

fn (n + 1) fn (n); , n (n) 2 fn (n)


(4.5.8). , NPRE

.
NPRH fn (n) = o(g (n)).
(4.5.5),
fn (n + 1) = fn (n) + fn (n) fn (n),

g (n + 1) = g (n) + g g (n),

g (n) .


(fn (n) + fn (n) fn (n)) (g (n) + g (n) g (n)) fn (n) g (n)
=
fn (n) g (n)

(n)
= fn (n) + g (n) + fn (n) g (n) = g (n) 1 + fn (n) + fn
, (4.5.9)
g (n)

n (n) =

g (n)  fn (n); ,
n (n) g (n) (1 + fn (n)).
, NPRH
.
NPR
.
.
, .
4.1. fA (n)
. fA (n), fA (n) = c nk , k > 0, , c > 0.
n (n)
n (n) =

c (n + 1)k c nk
c k nk1 + O(nk2 )
k
=
= + O(n2 ).
k
k
n
cn
cn

n (n)
k, fA (n + 1)
fA (n) n = 1 fA (n + 1) fA (n) + k
nk1 n. , k/n,

112

. 4.

k , c . , fA (n) = c n
n (n) = 1/n.
4.2.
fA (n) = c en ,

> 0,

c > 0.

(4.5.4)
n (n) =

c e(n+1) c en
c en e c en
=
= e 1 = const > 0,
n
ce
c en

, e 1 .
[4.17]:
n1. , (
)
:
0 < n n1 ,

n > 1.

n2. , ( , )
:
n = k n1 ,

n > 1,

k > 1.

n3. , (, ,
, ) :
n (n)  n1 ,

lim n (n) = 0,

 .
n4. , ( ) :
n (n) = const

lim n (n) = .

, ,
,
.

4.6.

-

4.6.

113

,
. ,
.
, . .
.
D A, |D| = n,
n . VA (D)
3.1. ,
, .
.
VI (D).
,
:
) , () ,
, VI (D) = VI (n);
) ,
,
. ,

. ,
, VI (D) = (1).
VR (D). :
) , ; ,
, .
VR (D) = 0, : ,
[4.2];
) . , , , ,
; ,
, VR (D) = (1).
Vt (D). , .
VI (D) VR (D) , , , , Vt (D) .
,
,
8 . .

114

. 4.

.
,

,
.
,
.
, ,
,
, .
,
.
V0 .
n > 0,

D Dn

Vt (D) = 0.


, /

. ,

.
VC .
n > 0,

D Dn

Vt (D) = const = 0.

VC ,
,
. , ,
,
.
VL ,
. n,
Vt (n):
Vt (n) = max{Vt (D)}.
DDn

,
Vt (n) = (n),
. ,
.
VQ , .

4.6.

115

n
:
Vt (n) = (n2 ).
, n.
n
2n
2 (n n) = (n2 ).
VP , . ,
, ,
, :
k > 2: Vt (n) = (nk ).
, , , (nk ), k > 1,
, (n).
VE , . , , , ,
:
> 0:

Vt (n) = (en ).

,
, . , . ,
, 100
10000 , 106 [4.18].
, , :
V (D) =

Vt (D)
,
VA (D)

n D Dn

0 V (D) 1,



.
8*

116

. 4.


4.1. ., ., . , : . . 2- . .: , 2002.
528 .
4.2. ., ., ., . :
: . . 2- . .: , 2005. 1296 .
4.3. ., ., . :
. .: .: , 2001. 384 .
4.4. . ., . . .
.: , 2002. 288 .
4.5. . . . .: , 1979. 96 .
4.6. ., ., . .
: . . .: , 2006. 703 .
4.7. . . // .
: . . 2- ., . .: , 2004.
. 303366.
4.8. ., . :
. . .: , 1981. 368 .
4.9. . ., . .

// . 2006. . 11. 1. . 5262.
4.10. . . . .: ,
2001. 256 .
4.11. . . . .: -
, 2004. 212 .
4.12. . ., . . .
.: , 2006. 296 .
4.13. / . ., . ., . .
4- . .: . , 2006. 636 .
4.14. . ., . .
//
: . VII (, 2425 2004). / . .
. . . .: , 2004. . 1926.
4.15. . . . . 1. : .
. 3- . .: , 2002. 720 .
4.16. . . : .
. 9- ., . .: . ., 2003. 479 .
4.17. . . //
. 2004. 4 (16). . 97104.
4.18. . ., . ., . ., . . // Exponenta Pro. .
2004. 2 (6). . 6470.

5





, . . .
,

.
, . .

.
.
, ,
.
, . ,

. ,
,
( O ),
- ,
O
. ,

, .

[5.1]:
f A1 (n) = 2,5n2 + 11,5n 10,

f A2 (n) = 18n log2 n + 85n 66,

A1 , A2 ; ,
-

118

. 5.

,
7 .

.

5.1.

n,
(f(n), g(n)). ,
f(n) g(n) n:
, . .
(f(n), g(n)) = (g(n), f(n)),
,
, . .
(f(n), f(n)) = 0.
,
;
(f(n), g(n));
,
(f(n))
. ,

:
|(f(n), g(n))| const n > 0.
, .
n = n1 [5.2]:
(a, b) = arctg

a
b
arctg ,
b
a

a = f(n1 ),

b = g(n1 ).

(5.1.1)


,
, /4.
n
,
(f(n), g(n))
/2 < (f(n), g(n)) < /2.

5.2.

119

;
, (f(n), g(n))
. ,
,

, .
, (f(n), g(n)) n.
z = (x, y),
.

5.2.


[5.2]:
, . .
. ,
;

.


DA ,
.
,
n .
( N) ( ) : fA (D Dn ) = fA (n). -
( NPRL, NPRE)
fA (n), .
- NPRH

f A (n),
.

120

. 5.

n, .
,
.
(
) ,

. (
) , , ,
, ,
, , , [5.3]. , ,
, .
,
,
-.

,
.
.
f(n) g(n)
, .
(a, b) n,
(f(n), g(n)) n;
[5.3] :
f(n) = (g(n)),
f(n) = (g(n)),
f(n) = o (g(n)),

min{(f(n), g(n))}
max |{(f(n), g(n))}| <
max{(f(n), g(n))}

n (a, b); (5.2.1)


n (a, b); (5.2.2)
n (a, b). (5.2.3)

, f(n) (g(n)) ( )
(a, b) , (f(n), g(n))
. ( ) , (a, b) , .
f(n) o (g(n)) ( ) (a, b) ,
(f(n), g(n))

5.2.

121

, . o :
, f(n) = o (g(n)), (f(n), g(n))
(5.2.1) (5.2.3) , g(n) = (f(n)).
.

[5.3]:

f(n) g(n) ,
N;

(n1 , n2 )
;
(n1 , n2 ) ,
(f(n), g(n)):
(f(n), g(n)) 0, f(n) = (g(n)), ,
g(n);
|(f(n), g(n))| < 0, f(n) = (g(n)),
;
(f(n), g(n)) + 0, f(n) = o (g(n)), ,
f(n).
(n1 , n2 )
.

, . 5.1.
, , ,
. (f(n), g(n))

. 5.1.
.

122

. 5.

,
(+, ) .
. . 5.2 f(n) g(n)
:

[5.3] f(n) = 1,75n2 + 2n ln n + 15n + 9;

[5.1] g(n) = 18n log2 n + 85n 66.

. 5.2. .

n1 = 71, n2 = 99, ,
= /32 ,
f(n) = (g(n)).
. 5.1
: f(n) g(n)
, (f(n), g(n)) [5.3].
, ,
= /32 0,0981.
,
= /32
73. 74 95

. 95
. ,

( 73 )

5.3.

123

5.1
n
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

f(n)
10501,051
10776,840
11056,157
11339,002
11625,373
11915,271
12208,696
12505,647
12806,123
13110,124
13417,651
13728,702
14043,278
14361,377
14683,001
15008,148
15336,818
15669,011
16004,727
16343,966
16686,726
17033,009
17382,814
17736,139
18092,987
18453,355
18817,244
19184,654
19555,584

g(n)
11908,705
12095,559
12282,664
12470,015
12657,609
12845,443
13033,514
13221,819
13410,355
13599,118
13788,107
13977,318
14166,748
14356,395
14546,256
14736,330
14926,612
15117,102
15307,795
15498,692
15689,788
15881,082
16072,572
16264,255
16456,129
16648,194
16840,445
17032,883
17225,504

(f(n), g(n))
0,1255
0,1152
0,1050
0,0949
0,0850
0,0751
0,0653
0,0557
0,0461
0,0366
0,0272
0,0179
0,0088
0,0003
0,0094
0,0183
0,0271
0,0359
0,0445
0,0531
0,0616
0,0700
0,0783
0,0865
0,0947
0,1028
0,1108
0,1187
0,1265

, .

5.3.

.

124

. 5.

.
.

.
,
, .
n , fA (n) gA (n) . fA (n)
gA (n)
N,
.
, x , . . fA = fA (x), gA = gA (x),
x = n. , fA (x), gA (x)
, ,
[5.3],
(5.3.1):
fA (x) > 0, gA (x) > 0 x > 1;
fA (x), gA (x)
[n1 , n2 ], n2 > n1 > 0;
fA (x), gA (x) : fA (x) 0,

gA (x) 0, . .
.
(. 5.2) ,
(a, b)
, ,
( ); [5.3].
5.1. ,
( n x),
[a, b] fA (x) gA (x)
-, . . fA (x) = (gA (x)),
|(fA (x), gA (x))| <

x (a, b).

(5.3.1)

x0 , , ,
|(fA (x0 ), gA (x0 ))| < .
-
[n1 , n2 ] fA (x), gA (x)
(fA (x), gA (x)), ,

5.3.

125

. [n1 , n2 ]
- , ,
fA (x) gA (x) .
. - :
u(x) = fA (x) gA (x);
u1 (x) = |fA (x) gA (x)|;

1, |(fA (x), gA (x))| < ;
d(, x) =
0, |(fA (x), gA (x))| ;
h(x, ) = u(x ) u(x + ),

> 0.

(fA (x), gA (x)) (5.3.1), [n1 , n2 ] [5.4] , (fA (), gA ())


(fA (x), gA (x)) [n1 , n2 ]:
[n1 , n2 ]:

(fA (), gA ()) = min {(fA (x), gA (x))}.


x[n1 ,n2 ]

d(, ) = 1, [n1 , n2 ]
-. d(, ) = 0,
,
.
,
:
f(n) = (g(n))

f(n) = o (g(n)) n [n1 , n2 ].

d(, ) = 1, ,
-
. :
- ;
- , .
.
5.2. - , 0
> 0,

> 0: d(, x) = 1,

x [ , + ].

fA (x) gA (x)
, ,
,
. 5.3.

126

. 5.

. 5.3. -.

5.3. - ,
0 : < 0 > 0,

> 0:

d(, x) = 1,

x [ , + ]

d(, ) = 0.

5.1. [n1 , n2 ] - - fA (x), gA (x), (5.3.1),


, u1 () = min {u1 (x)},
x[n1 ,n2 ]

, u1 () = 0.
. u1 () = 0, (fA (x), gA (x)) ,
, fA () > gA ():
(fA (), gA ()) = arctg

fA ()
g ()
f ()

arctg A
= 2 arctg A
=
gA ()
fA ()
gA ()
2

u1 ()

= 2 arctg 1 +
. (5.3.2)
gA ()
2

(fA (), gA ()) 0. arctg 1 = /4


u1 () = 0, u1 () > 0
u1 (x), (5.3.3) 0 > 0.
- -, d(, ) = 1
0, , u1 () = 0,
d(, ) = 0 0 < < 0 , .
u1 () = 0 , fA (x), gA (x) , .
h(, ).
0 h(, ) > 0, ;
0 h(, ) < 0, , - -,
. 5.4.

5.3.

127

. 5.4. - -.

fA (x), gA (x) ,
Oy ( ) , ,
- -.
,
. [5.3].
5.2. fA (x), gA (x) [a, b], u(x) = fA (x) gA (x)

: u (x) = 0, x [a, b], fA (x), gA (x)
[a, b]
.
. [5.4], [a, b]
f(x) f(a) = f(b),
, , f() = 0. ,
u(x) Ox [a, b] x1 ,
x2 , x3 (. . 5.5). [a, b] [x1 , x2 ],

. 5.5. u(x) Ox.

1 [x1 , x2 ]: u (1 ) = 0, [x1 , x2 ]
2 [x1 , x2 ]: u (2 ) = 0. u (x)

[1 , 2 ]: 3 [1 , 2 ]: u (3 ) = 0,
.

128

. 5.

, u(x).

, u(x) .
, [a, b] , u (x) = 0,

, , , u (x) = 0.

, u (x) = 0 u(x) Ox [a, b],
.
, - -
,
.

. 5.6.

. 5.6.
( ).


, , - -
.
, . ,
, , . -

129

,
- [5.3].


5.1. . ., . . .
.: , 2006. 296 .
5.2. . . . .: - , 2004. 212 .
5.3. . . //
. 2004. 15. . 3239.
5.4. . ., . ., . . .
.: , 1979. 720 .

9 . .

III


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


. ,
, ,
. ,
.
, , ,
,
. ,
,
.
, ,
, , -,
, -,
. ,
,
, , .


.

6.1.

131

6


, , , ,
.
.

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

6.1.
, ,
, ,
. ,
, ,
.
[6.1].
.
1. . .
2. .
, 1
, ,
9*

132

. 6.

,
.
3. . .
4. .

.
. -, ,
.
, , . -,
, .
, , , ,
; .
[6.2]
,
, . ,

, ,
, , ,
.
,

. . . 1962 .
, , n2 , .
, , n3 [6.1].
, , 9.
.
6.1.
, .

V. ,
n ,
.
1. n
, n/2 n/2 .
2. ,

.
3.
, : , , .

6.1.

133

4. , .
,
.

(n ln n). -
100
,
.
6.2.
. ,
n .
:
1. . n ,
n/2 . ,
:




a b
e f
r s

=
,
c d

g h

t u

:
r = a e + b g;
s = a f + b h;
t = c e + d g;
u = c f + d h.

(6.1.1)
(6.1.2)
(6.1.3)
(6.1.4)


n/2. (6.1.1) .
2. n/2
n/2 , ,
.
3. 2 2,
(6.1.1),
.
4. , n/2 n/2
. (6.1.1)
.

, -

134

. 6.


,
S(n) = 8 S(n/2) + (n2 ).

S(n) = (n3 ) , 9,
, ,
,
. , . (nlog2 7 ).
, n/2 n/2
, ,
. ,
, [6.1].

. ,
,
, .
,
.

6.2.

,
,
.
,

. , ,
. . .

.


. .
6.3. P(m) . m k (k 1).
, m

6.2.

135

[6.3]. m = 6
, .
6;
5 + 1;
4 + 2, 4 + 1 + 1;
3 + 3, 3 + 2 + 1, 3 + 1 + 1 + 1;
2 + 2 + 2, 2 + 2 + 1 + 1, 2 + 1 + 1 + 1 + 1;
1 + 1 + 1 + 1 + 1 + 1.
, [6.3] ,
m. , ,
P(m) Q(m, n),
m , n. Q(m, n) , P(m), . . P(m) = Q(m, m).
, , , Q(m, n) , , Q(m, n)
.
[6.3] (, ).
.
1. Q(m, 1) = 1, m
, , , m = 1 + 1 + . . . + 1.
2. Q(1, n) = 1: , . .
1, n.
3. Q(m, n) = Q(m, m), m n. , m - n, , m.
4. Q(m, m) = 1 + Q(m, m 1). m
, m, m
n m 1.
5. Q(m, n) = Q(m, n 1) + Q(m n, n).
: m , n, n
Q(m, n 1),
n,
m n, Q(m n, n).

Q(m, n) :

Q(m, 1) = 1;

Q(1, n) = 1;
(6.2.1)
Q(m, n) = Q(m, m), m n;

Q(m,
m)
=
1
+
Q(m,
m

1);

Q(m, n) = Q(m, n 1) + Q(m n, n).

136

. 6.


m
Q(m,n), Q(m,m)
:
Q(m,n)
If (m = 1) or (n = 1)
( )
then
Q 1
( Q)
If (m < n)
then
Q Q(m,m)
( , m<n)
If (m = n)
then
Q 1+Q(m,m-1)
( , m=n)
else
Q Q(m,n-1)+Q(m-n,n)
( , m>n)
Return (Q)
End.

, Q(m,n) ,
, ,
. ,
Q(m,n) , , .
,
, .
, , , ,
Q(m,n)?
: , ,
, ?
, , ,
,
.
6.4. ,
.
, .
[6.4]: x ,
, , . ,
n ,

6.3.

137

n + 1, , n
, n 1. ,

n, m .
: n + m = n, m = 0.
m
.
:
n + m = (n + 1) + (m 1).
S(n, m),
:

S(n, m) = n,
m = 0;
S(n, m) = S((n + 1), (m 1)), m > 0.
, .
[6.5].

6.3.
. 1960- [6.6].

, [6.2]. .
. [6.6] , , , . .
. .
,
,
, . .
f(x) =

n
X

gi (xi ),

x = (x1 , . . . , xn );

(6.3.1)

i=1

, . , [6.6].

138

. 6.

, ,
n
X

xi = C,

xi 0 i = 1, n.

i=1

,
n ,
. gi (xi ), i = 1, n,
xi .
(6.3.1): f(x) max, ,
, n
0 n.
,
. , , , ,
[6.6].
f(x)
n C.
{fi (c)}, i = 1, n,
0 c C, :
fi (c) = max f(x1 , . . . , xi ),
x1 , ...,xi

xi 0,

i
X

xj = c.

j=1

fi (c) ,
c i .
. , :
gi (0) = 0, i = 1, n, , fi (0) = 0, i = 1, n. ,
c 0 f1 (c) = g1 (c).
, fm (c) fm1 (c) m c.
xm , m,
(c xm )
(m 1) .
, xm
m
gm (xm ) + fm1 (c xm ).
, xm ,
, -

6.3.

139

,
[6.6]:

f1 (c) = g1 (c);
(6.3.2)
fm (c) = max [gm (xm ) + fm1 (c xm )], m = 2, n, c 0.
0xm c

, , .
() . ,


, .
(6.3.2) .

, . .

, .

,
,


.

.
6.5. . , , ,
. (
, , . .) ,
.
; ,
, .
. . [6.7], .

(I),
(D),
(R) (M).

140

. 6.

.
.
.
( ) :
I

R M M M M M M M R


, ,
. ,
; ,
. 5 ,
, .
[6.8], . ,
S1 S2
S1 [1 . . . n] S2 [1 . . . m]. D(i, j),
S1 [1 . . . i] S2 [1 . . . j]. D(i, j)
i
S1 j S2 . ,
S1 S2 D(n, m).
,
, D(i, j) , D(n, m)
. ,
, , , D(n, m)
D(i, j), i = 0, n,
j = 0, m. D(i, j)
, ,
D(i, 0) = i;
D(0, j) = j.

(6.3.3)

, i
i .
j j .
,
[6.8].

6.3.

141

. i j ,


D(i,j) = min D(i 1,j) + 1, D(i,j 1) + 1, D(i 1,j 1) + t(i,j) , (6.3.4)


t(i,j) =

1,
0,

S1 [i] = S2 [j];
S1 [i] = S2 [j].

. , S1 [1 . . . i] S2 [1 . . . j]
.
, I, D, R M.
.
I, S2 [j] . S1 [1 . . . i] S2 [1 . . . j 1]. ,
D(i, j 1) . , I,
D(i, j) = D(i, j 1) + 1.
, D
, S1 [1 . . . i],
S1 [1 . . . i 1] S2 [1 . . . j]. ,
D(i 1, j) . , D,
D(i, j) = D(i 1, j) + 1.
R, S1 [i] S2 [j],
S1 [1 . . . i 1] S2 [1 . . . j 1]. D(i, j) = D(i 1, j 1) + 1.
M, S1 [i] = S2 [j], ,
D(i, j) = D(i 1, j 1).
t(i, j),
:
R M, D(i, j) = D(i 1, j 1) + t(i, j).
.
S1 [1 . . . i] S2 [1 . . . j]?
S1 [1 . . . i] S2 [1 . . . j 1] D(i, j 1) S2 [j] , D(i, j 1) + 1 . S1 [1 . . . i 1] S2 [1 . . . j] D(i 1, j) S1 [i] , D(i 1, j)+1
. , , ,
D(i 1, j 1) + t(i, j) .
,

142

. 6.

; , . , D(i, j) (6.3.4)
.
,

,

D(i, 0) = i, j = 0;

D(0, j) = j, i = 0;

D(i, j) = min{D(i 1, j) + 1, D(i, j 1) + 1, D(i 1, j 1) + t(i, j)},

i > 0, j > 0.
(6.3.5)

,
.
,
[6.8].
,
,
.
, ,

, [6.2].
,
, . . . ,
, ,
.
V.


6.1. n,
. , n . G(n) ,
n,
. ,
G(n). ?

143

6.2. ,
M(n, m),

.
6.3. n , . ,
, : ,
, , .
?
6.4. ,
. ,
? ,

.
6.5. , ,
, D(4, 4).
.

R(n, m) n m .

D(20, 25)?


6.1. ., ., ., . :
: . . 2- . .: , 2005. 1296 .
6.2. . : . .
.: , 2005. 400 .
6.3. ., . :
. . .: , 1981. 368 .
6.4. .., .. . .: , 2005. 240 .
6.5. . : . . .:
, 1974. 79 .
6.6. ., . : . . .: , 1965. 457 .
6.7. .. ,
// . 1965. . 163. . 707710.
6.8. . , . : . . .:
; , 2003. 654 .

7


, ,
. ,

.
,
.

,
,
. ,
m-
() ,
, m- .
50
, ,
.
.

7.1.

m- .
, .
, , ,
. m- [7.1].
m- (x1 , x2 , . . . , xm ),

7.1. 145

m x1 , x2 , . . . , xm ,
Am . m- ,
x, x1 , x2 , . . . , xm x. m-
x,

,
m- . Am m- ,
x, y m- Am (x, y),

(x, y) = (x1 y1 )2 + (x2 y2 )2 + . . . + (xn yn )2 .
(7.1.1)
m- Em .
, ,
x, y (x, y),
, :
1) (x, y) = (y, x);
2) (x, y) (x, z) + (z, x);
3) (x, y) 0, (x, y) = 0 x = y,
. , , (7.1.1),
, , Em . , , ,
[7.1] [7.2].
Em , . Em ,
Em ,
. m-
, Em
z:


m
Em
z = x | x E , x = (x1 , x2 , . . . , xm ), xi Z i = 1, m ,
Z .
, , , Em
z,
: ,
, . m-
10 . .

146

. 7.

. Y y Em
z , (y1 , y2 , . . . , ym )

0 yi xi k

i = 1, m,

(7.1.2)

m- k m
x = (x1 , x2 , . . . , xm ), x Em
z , Kz (x, k).

m-
0 = (0, . . . , 0), . . Km
z (0, k),
m
: Km
z = Kz (0, k). , m
, 1z m- ,
0 1.
, Y Em
z , (y1 , y2 , . . . , ym )
(x, y) = r, m-
r x = (x1 , x2 , . . . , xm ), x Em
z,
Sm
z (x, r).
m-
? , . .
, .
(7.1.2)
(k + 1)
m Em
z ,
m
, |Km
z (x, k)| = (k + 1)
m
. , 1m
z 2 .
,
.
.
G Em
z .
x G
f(x) : G R, R .
, [7.2],
.
, , . . ()
gi (x): G R, i = 1, k
gi (x) ai ,

ai R,

i = 1, k,


f(x) min

gi (x) ai ,

ai R,

i = 1, k,

x G.

(7.1.3)

x, G,

7.1. 147

f(x). (7.1.3) - x, (7.1.3), , .


. (7.1.3) ,
G, .
,
:
,
f(x) gi (x) ;
( ),
f(x) gi (x)
.
, G
, .
. , Em ,

. f(x), G, , x, y G

0 1,

f(x + (1 )y) f(x) + (1 ) f(y).

. , .
.
, n .
. xi
i- , , xi 1, i = 1, n.
,
. , fi (xi ),
i,
. pi
i (i = 1, . . . , n), fi (xi ) , ,
:
fi (xi ) = 1 pxi i .
, ,
. ,
10*

148

. 7.


, c ,

,

n
Y

fi (xi ) max,

i=1

n
X

ai xi c,

x = (x1 , . . . xn ) Enz ,

xi 1.

i=1

,

.
, xi xj , j = i.

.
. , ,
,
. ,
n . xi ,
i- , ci
i, i = 1, n.

f(x) =

n
X

ci x i .

i=1

b (),
n
X

xi = b.

i=1

i bi ,
, .

f(x) min,

n
X

xi = b,

0 x i bi ,

i = 1, n,

x Enz .

i=1

(x En )
;
,
. , n- bi .

7.2.

149

. , .

.
m , n , n > m.
,
.
. tij
i j.
.
x Enz
xi , i.
. m
- ,
:
1 xi m,

i = 1, n.

, G
Knz (1, m) 1 = (1, 1, . . . , 1) n- m.
, ( ) ,
f(x) = max {Tj } min,
j=1, ...,m

Tj j,
Tj =

n
X

[xi = j] tij ,

i=1

:

1, k = l,
[k = l] =
.
0, k = l,

7.2.

1950- 1960- .
,

150

. 7.

, .
, ,
NPC,
. ,
( )
,
[7.2].
. ,

.
,
, , ,
, . 7.3.

. .
.
, .
.
: , , , ,

.
British museum technique .

, :
, .
, , , n
1nz 1 .
. . . [7.2]. . ,

.
, .

7.2.

151

,
, ,
,
. ,
.
, .
,
. ,
. :
Procedure
Begin
1.

While (
)
begin
2.1. ,

2.2.

end
end while
End.

, , , ,
.
, . , .
. . . [7.3] 1960- .
. , . , . . [7.4]
, NP- ( NPC).

,
. , .

152

. 7.


( )
.
,
, .
.

, .
. ,
;
.
12.

7.3.

. NP-

. ,
[7.5]
, , , [7.6], [7.5], .
, .
. ,
,
. ,
, .
. ,
, .

. , , . ,

7.3.

153

, ,
. , ,
. ,
. ,
.
, , .
, ,
.
, ,
(1975 .).
. , , ,
, [7.7].
,
( ) .
.

.
. , , ,
.
,
. ,
[7.7]. ,
, , ,

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

. , -

154

. 7.

.
.
.
(, ).
,
.
.
, (11, 12, 13, 14) (0, 0, 0, 0)
,
(11, 12, 0, 0) (0, 0, 13, 14).
. [7.8] f(x1 , x2 ) :
0 < x1 < 1, 0 < x2 < 1. ,
x1 x1 , ,
. , 10- x1 x2 .
,
210 1. , 0000000000 0/1023,
0, 1111111111 1023/1023, 1. 20- ,
() x1 x2 . x1 10 , x2
. ,
20-
( ),
.
(x1 , x2 ).
,
.
.
,

.
[7.8].
(
), n .
, ,

. ,
. () i P(i),

7.3.

155

( ):
P(i) =

f(i)
n
X

f(i)

i=1

( ) n , P(i).

(, 1989 .).
, i-
P(i). ,
, .
n Pc , n
n/2 . Pc
. ,
. . , . .
.
. .
. ,
, Pm .
, , ,
.
( ) ,
. , ,
. , .
, , , ,
. ,
:
Procedure
1. .
2. , .
3. .
4. .
5.
.
6.
.

156

. 7.

7. .
8.
.
9. .
10. .
End.

. ,

.
,
[7.6, 7.9].

,
[7.6, 7.7, 7.11]. [7.8].
(, 1981 .; ,
1991 .) n n .
k
. ( , 1975 .)
,
.
,
, .
.
(, 1989 .) (, 1989 .) . ,
, . ,
;
.
, ,
( ),
() [7.5]. ,
, . . ,

,
[7.5].
. , , . ,
?
. ,

, :

7.3.

157

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


. , ,

.
NP- , ,
, , .

[7.7].
.
, .

. ,
, .

, .
1990- ,
,
[7.117.13].
. , .
.
,
(Formica lugubrus),
. -

158

. 7.

, [7.14].
,
.
, ( ,
) ,
.
(stigmergy)
,
,
, , . ,
(pheromone) ,
.
.
, .
,
, ,
[7.14].
. ,
, .
,
.

, .
,
.
. ,
,
. ,
, ,
. , ,
, , -
.
,
. ,
:
.

7.3.

159

,
,
,
,
. .

.

n .
, ,
() .
NP-,
.

. . [7.14].
.
,
.
, , ,
. , ,

. ,
.
,
; ,

. , ,
:
.
,
. Ji,k , k,
i;

j, i.
, nij Dij
i j:
ij = 1/Dij .

, j i,

160

. 7.

. (i, j)
t ij (t).
- [7.14],
k- i j:

(ij (t)) (ij )

, j Ji,k ;
Pij,k (t) = X
(il (t)) (il )
(7.3.1)
lJi,k

Pij,k (t) = 0, j
/ Ji,k ,
, , ( = 0 :
). , ,
(7.3.1) j;
Ji,k ,
. (7.3.1) ,
,
. . .
(i, j), ,
. Tk (t) ,
k t, Lk (t) .
Q, ,
.

Q , (i, j) T (t);
k
ij,k (t) = Lk (t)
0,
(i, j)
/ Tk (t).
, ,
. p [0, 1] ,

ij (t + 1) = (1 p) ij (t) + ij (t);

ij (t) =

m
X

ij,k (t),

(7.3.2)

k=1

m .

. , .

, ,
. T
, L . e
,
e = e Q/L .
(7.3.3)

7.3.

161

.
.
Procedure
1. D.
2. , , e, Q.
3. ij
.
4.
.
5. L*.
6. t=1, tmax .
7. k=1,m.
8. Tk (t) (7.3.1)
Lk (t).
9. .
10. Lk (t)
L*.
11. , L* T*.
12. .
13.
(7.3.2) (7.3.3).
14. .
15. .
16. T* L*.
End.

(tmax max(m, n2 )),


; , , .
.

, ,
. , .
,
, [7.14]. [7.15]
GPS
. ,
, ,
, , , [7.14].
11 . .

162

. 7.


-

. ,
.
,
. [7.14] ,
, ,
. ,
, ,
.

[7.15].


7.1. .., .., .. .
.: , 1979. 720 .
7.2. .. . : , 1995. 192 .
7.3. Land A. H., Doig A. G. An automatic method of solving discrete
programming problems // Econometrica, v. 28 (1960), pp. 497520.
7.4. Little R. D. C., Murty K. G., Sweeney D. W., Karel C. An Algorithm for the
Traveling Salesman Problem // Oper. Res., 11 (1963), pp. 979989.
7.5. . , . : . .: ;
-, 2003. 654 .
7.6. ., ., . , : . . .:
-, 2004. 452 .
7.7. . ., . ., . .
/ . . . . 2- ., . . .: ,
2006. 320 .
7.8. http://www.basegroup.ru/library/optimization/ga_math.
7.9. http://www.neuroproject.ru.
7.10. http://math.nsc.ru/AP/benchmarks/UFLP/uflp_ga.html.
7.11. Bonavear E., Dorigo M. Swarm Intelligence: from Natural to Artificial
Systems. Oxford University Press, 1999. 307 p.
7.12. Corne D., Dorigo M., Glover F. New Ideas in Optimization. McGrav-Hill,
1999.
7.13. http://iridia.ulb.ac.be/dorigo/ACO/ACO.html.
7.14. . . // Exponenta Pro.
. 2003. 4. . 7075.
7.15. http://www.swarm.org.

IV

, .
,
,
, .
, ,
, .


,


.
,
(. 4) ,
. , , ,


.


,
.
,
.
, . ,
,
,
.
,
11*

164

. 8.

, .

V,
- .

8

, ,
. 1960- ,

, , .
,
.

8.1.

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

(
, -, ). , ,
, /
.

8.1.

165

(. 2), , :
, .

;
,
;
, . . .
.
,
() .
,
.
.
.
.
, :
f = f1 + . . . + fk ,
k . ,
,
, , ,
, .
.
:
If (l)
then
fthen ,
p;
else
felse ,
(1-p)
end If.

(l) , / ,
(1)
.

166

. 8.

, / .
- p
.

p then.
f = fl + fthen p + felse (1 p),
fl (l). ,
p : p = p(D).
,
, ,
.
.
:
For i 1 to n

end For

i 1
Repeat

i i+1
until i n

:
f = 1 + 3 n + n f



. k

, , , [8.1].
.
( )
.
- ,
.
.
. , ,

()
,
.

8.2. -

167

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

,
.
NPR, ,
. ,
, , ,
[8.2], [8.3],
[8.4].
.

8.2.
-

N . ,
,
2 ,
,
(. 8.1)
.
[8.2, 8.3, 8.5, 8.6],
.
.
1.
, , .
2. .
: ,

168

. 8.

, ,
.
3.

: , , ,
,
.

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

[8.7].
,
, , N.

.
8.1.
. :
SumM (A, n; Sum)
Sum 0
For i 1 to n
For j 1 to n
Sum Sum + A[i,j]
end For j
end For i
Return (Sum)
End.

1
1+3n
1+3n
4

, , n. , N.
,
. ,
Sum A[i,j]
2 .
, ,
fA (n) = 1 + 1 + (3 + 1 + (3 + 4)n)n = 7n2 + 4n + 2 = (n2 ).

8.2. -

169

, n , . . ,
n2 .
,
,
[8.3].
, n2 , ;
, :
VA (n) = n2 + 3.

,
c (A) = (n2 ), (n2 ).
8.2. , .
X, n , Y
n n .
, [8.8]. Mx, My[i] Y
. :
Cov_calc (X, Y, Mx, My, n; Cov)
For i 1 to n
s 0
For j 1 to n
s s +(X[i] - Mx)*(Y[i,j] - My[i])
end For j
Cov[i] s
end For i
Return (Cov)
End.

1+3n
1
1+3n
9
2

N, , .
,
fA (n) = 1 + (3 + 1 + 1 + 2 + (3 + 9)n)n = 12n2 + 7n + 1 = (n2 ).
: X, Y MY, Cov,
i, j, Mx, s; ,

VA (n) = n2 + 3n + 4,

170

. 8.


 (A) = (n2 ), (n2 ).
8.3. .
:
MultM (A, B, n; C)
For i 1 to n
For j 1 to n
Sum 0
For k 1 to n
Sum Sum + A[i,k]*B[k,j]
end For k
C[i,j] Sum
end For j
end For i
Return (C)
End.

1+3n
1+3n
1
1+3n
7
3


N. ,

; , ,

fA (n) = 1+(3+1+(3+1+1+3+(3+7)n)n)n = 10n3 +8n2 +4n+1 = (n3 ).


n

.
, n2 , ,
;
,
VA (n) = 3n2 + 4.

c (A) = (n3 ), (n2 ).
8.4. n .
. X Y.
S, n n ,
. :

8.3.
Lcalc (X, Y, n; S)
For i 1 to n
S[i,i] 0
For j i+1 to n
dx (X[i] - X[j])
dy (Y[i] - Y[j])
S[i,j] dx*dx + dy*dy
S[j,i] S[i,j]
end For j
end For i
Return (S)
End.

171
1+3n
3
2+3n
4
4
6
5

N, , .
, (n i) (i),

n
X

(n i) = n2

i=1

n(n + 1)
n2 n
=
.
2
2

, ,
fA (n) = 1 + (3 + 3 + 2)n + (3 + 4 + 4 + 6 + 5)

n2 n
= 11n2 3n + 1 = (n2 ).
2

: X, Y,
S, : i, j, dx, dy; ,

VA (n) = n2 + 2n + 4,

c (A) = (n2 ), (n2 ).

8.3.
-
- (NPR)
,
. ,
.

172

. 8.

.

, .
- fA (n) NPR
.

, , , ,
[8.4], [8.3]. , [8.9]
[8.6].
,
,
[8.4]. :
Dn
,
. ,
,
, , .
;
, . ,
,
,
, ;
,
, .
, , , , , .
,
-, ,
[8.4].

:
fA (n) =

m
X
i=1

pi fi (n),

m
X
i=1

pi = 1,

8.3.

173

n D Dn , . . ; m ;
pi , i;
fi (n) ,
i
.
,
, ,
.
,
n .
8.5. .
Max1(A, N; Max)
Max A[1]
For i 2 to N
If Max < A[i]
then
Max A[i]
end If
end For
Return (Max)
End.

, ,
1 , . ,
n : 1 (n 1) .
,
, ,
( ), . .
.

.
.
, , 10 .
10 10! = 3628 800.
10
. 362 880 , ;
(1 9 ).
,
2 9 .
362 880. .
,
. ,

174

. 8.

. ,
!
, .

. ,
, ,
, . 10: ,
.
, ,
[8.2]: , , ,
? ,

.
.

8.4.
. , , , , . , ,
. -
.
,
.

( ) .
, ,
. (
[8.3]),
.
, , ,
, . ,
.
: -

8.4.

175


. ,

.

. n
; ,
c(n), ,
, , c(n)/n.
,
. ,
.
,
.
,
;
. , , ,
[8.3].
, V:
, .
.
,
:
Push(x) x ,
;
Pop(x) ,
, x;
Multipop(x, k) k ,
k , .
, , Push(x) Pop(x)
(1) ; , n , (n)
.
Multipop(x, k), ,
, m ,
,
(min(m, k)).

.

176

. 8.

. ,
, n .
Pop(x), ,
Multipop(x, k), Push(x):
, . n
, Push(x) n.
, n
Push(x), Pop(x) Multipop(x, k), , (n).
,
, , Multipop(x, k),
(n)/n = (1).
.

,
. ,
.
:
Push(x)
2;
Pop(x)
0;
Multipop(x, k) 0.

, . ,

. , ,
. ,
Pop(x) Multipop(x, k) ,
.
n Push(x), Pop(x)
Multipop(x, k)
2n , ,
(1).


8.1. , (Case).
,
.

177

8.2. 8.4 ( 8.2)


.
,
.
.
8.3. , , 8.2,
?
8.4. 8.5 8.3
.
, ?
8.5.
8.4 . , .


8.1. ., ., . .
: . . .: , 2006. 703 .
8.2. ., . :
. . .: , 1981. 368 .
8.3. ., ., ., . :
: . . 2- . .: , 2005. 1296 .
8.4. . : . . 2-
., . .: , 2004. 368 .
8.5. ., ., . : . . .: , 1979. 546 .
8.6. . . . . 1. : .
. 3- . .: , 2002. 720 .
8.7. . . . .: -
, 2004. 212 .
8.8. . ., . . / .
. . . 3- ., . . .: , 2003.
544 .
8.9. ., . : . . .:
, 1970. 272 .

12 . .

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


.

. ,

,
. ,
, . ,
.
,
.

9.1.
,
, 6,
.

9.1.

179

. ,
,
, 1980 . . , .
. [9.1].
, .
(J. L. Bentley, Dorothea Haken, J. B. Saxe, 1980).
a 1 b > 1 , f(n) , T(n) n
 
n
+ f(n).
T(n) = aT
b

:
1) f(n) = O(nlogb a ) > 0, T(n) = (nlogb a );
2) f(n) = (nlogb a ), T(n) = (nlogb a logb n);
3) c > 0 > 0, ,
n
f(n) > cnlogb a+ ,
r < 1, ,
n
 
n
af
rf(n),
b

T(n) = (f(n)).
.
c .
9.1. ,

,
. T(n), ,
 
n
+ cn.
T(n) = 8T
4

: a = 8, b = 4, f(n) = cn, nlogb a = nlog4 8 = (n3/2 ).


1
2

f(n) = O(n3/2 ) = , , , , T(n) = (n3/2 ).


12*

180

. 9.

9.2. ,
, T(n)
 
3n
+ 5.
T(n) = T
4

T(n)
: a = 1, b = 4/3, f(n) = 5,
nlogb a = nlog4/3 1 = n0 = (1). .
f(n) = 5 = (nlogb a ) = (1),
, T(n) = (log4/3 n).
9.3.

, :
f(n) = cn log4 n.
T(n)
 
n
T(n) = 2T
+ cn log4 n.
4

( ): a = 2, b = 4, f(n) = cn log4 n,
nlogb a = nlog4 2 = n0,5 = ( n), , , n = 0,5
f(n) = cn log4 n n0,5+ .
,
. n
 
n
n
n
1
1
2f
= 2 log4 n log4 n = rf(n), r = < 1,
4

, T(n) = (n log4 n).


9.4. ,
. h f(x) = 0, f(x) .
, - , [a, b] , , .
,
. f(a) < 0, f(b) > 0.
, ,
[c, d], f(a) < 0, f(b) > 0
d c h.
[9.2] f(x) = 0. a1 = a, b1 = b. ,

9.2.

181

f(a1 ) < 0, f(b1 ) > 0, , ,


, x
f(x) = 0 [a1 , b1 ].
[ai , bi ], f(ai ) < 0,
f(bi ) > 0 bi+1 ai+1 < bi ai , . . , , . c c =

ai + bi

2

f(c). : f(c) < 0 f(c) > 0. (


f(c) = 0 .) f(c) < 0 ai+1 = c, bi+1 = bi .
, f(c) > 0, ai+1 = ai , bi+1 = c.
. bi+1 ai+1 < h.
, , n. n, ,
. n ,
h :


ba
.
n=
h


 
n
T(n) = T
+ c,
2

c ,
. T(n)
:
T(n) = (log2 n).
, V,
-
.

9.2.

,
,
.

182

. 9.

.

.
(IBM PC)- [9.3].
,

.
,
: , , ,
.
,
,
.
,
,
. -
:
p ,
k ,
r ,
l .

- fR (1).
-
,

fR (1) = 2(p + k + r + l + 1).

(9.2.1)

(9.2.1) .
, . f, ,
, -
:
fR (1) = 2 (p + k + r + f + l + 1),

f = 1.

(9.2.2)


-
,
,
, .

9.2.

183

(9.2.1) (9.2.2) ; ,
f = 0 (9.2.2),
(9.2.1).
.
, ,
,
, , .
, , ,
, . ,
, ,
, ,

[9.4, 9.5]. , ,
,

.
: ,
,
. ,
,
. , ,
. HR (D)
,
D,
. , , , ,
, ,
(9.2.2) :
Vst (D) = HR (D) (p + k + r + f + l + 1) lw ,

(9.2.3)

lw .
,

,
-, (9.2.2),
. ,

.

184

. 9.

, ,
,
.
(., ., [9.1, 9.4, 9.5]).
;
, ,
, .
. , ,
-,
( ) , .



. , , ,

[9.6].
.
, n N,
NPR; m1 , . . . , mk PR, NPR
(k n), D , ,
:
R(D) D;
RV (D) D;
RL (D) D;
HR (D) (

). ,
R(D) = RV (D) + RL (D),

HR (D) RV (D) + 1.


,
.
(. . 4) :
N: R(D) = R(n) D Dn ;
PR: R(D) = R(m1 , . . . , mk );
NPR: R(D) = R(n, m1 , . . . , mk ).

9.2.

185

, RV (D), RL (D) HR (D)



. , ,

.
( )
BL (D) =

RL (D)
,
R(D)

0 < BL (D) < 1.

(9.2.4)

BL (D) ( )
,
.

.
,
. , fA (D)
A D ,
, ,
. :
fR (D) ,
fC (D) ,

fA (D) = fR (D) + fC (D).

(9.2.5)


, : R(D)
fR (1) , , , (9.2.2),
fR (D) = R(D) fR (1).
(9.2.6)

,
,
; ,
.
:
fCV (D) ,
fCL (D)
,
fC (D)
fC (D) = fCV (D) + fCL (D).

(9.2.7)

186

. 9.

fCL (1) ,
, , , fCL (1)
, . . . , fCL (D):
(9.2.8)
fCL (D) = RL (D) fCL (1).
,
.

, .

, . ,
HR (D). m
, m = 1, HR (D) 1, k
: k = 1, K(m), K(m)
m; , k
, .

vmk ,

m = 1, HR (D) 1,

k = 1, K(m);

,
HRX
(D)1 K(m)
X
m=1

1 = RV (D).

k=1

vmk
fCV (vmk ),
fCV (D) =

HRX
(D)1 K(m)
X
m=1

fCV (vmk ).

(9.2.9)

k=1

, fCV (vmk )
, . . , ,

fCV (v),
(9.2.10)
fCV (D) = RV (D) fCV (v).
(9.2.5),
:

fA (D) = R(D) fR (1) + RL (D) fCL (1) +

HRX
(D)1 K(m)
X
m=1

k=1

fCV (vmk )

(9.2.11)

9.2.

187

,
,
fA (D) = R(D) fR (1) + RL (D) fCL (1) + RV (D) fCV (v).

(9.2.12)

BL (D)
. FR (D),
:
FR (D) =

fR (D)
,
fA (D)

0 < FR (D) < 1.

(9.2.13)

FR (D) , .

1. :
R(n, m1 , . . . , mk ), RL (n, m1 , . . . , mk ), RV (n, m1 , . . . , mk ), HR (n, m1 , . . . , mk ),
(n) / .
2. fR (1)
-, , (9.2.2).
3. fCL (1) .
,
,
.
4. fCV (vmk ).
5.
(9.2.11) (9.2.12) fCV (vmk ).
fCV (vmk ).
,
.
,
, .
fCV (vmk ) ,
. , fCV (vmk )
. ,
, [9.1],

188

. 9.

fCV (vmk )
, .


V.

9.3.
,
, .
,
, , ,
, [9.6].
,

.
,
, .
, . ,
,
.
, n,
, a
n/b (b n),

(9.3.1)
fA (n) = a fA (n/b) + d(n) + U(n),
d(n) ,
U(n) ,
. n0 ,
( ) .
fA (n0 ),

, ,

fA (n0 ),
n = n0 ,
(9.3.2)
fA (n) =
a fA (n/b) + d(n) + U(n), n > n0 .
, .

9.3.

189

(9.2.1), ,
fR (1),

fA (n0 ) + fR (1),
n = n0 ,
(9.3.3)
fA (n) =
a fA (n/b) + d(n) + U(n) + fR (1), n > n0 .
, ,
, .
n/b
(9.3.2)
, . . n/b n/b.

[9.1].
, d(n) = (1) = c1 ,

, .
, , ,

c2 .
a n + b, .
fR (1) = c3 ,
, (9.3.3),


c2 + c3 ,
n = 1,
fA (n) =
fA (n/b) + fA (n/b) + c1 + an + b + c3 , n > 1.
, .
, n n 1, fCV (n)

. , , n0 = 1.
, 9.2: fCL (1)
( fCL (1) = fA (n0 )) fR (1)
/,

fR (1) + fCL (1),
n = n0 ,
(9.3.4)
fA (n) =
fA (n 1) + fR (1) + fCV (n), n > n0 .
(9.3.4) , . n = 2
c1 .

190

. 9.

fR (1) = c2 .
n n 1
[9.6]
fCV (n) = an2 + bn + d,

,
8. (9.3.4),
,
,

c1 + c2 ,
n = 2,
fA (n) =
fA (n 1) + a n2 + b n + d + c2 , n > 2.
, , ,
[9.6].
, ,
, ,
. ,

,
, , ,
.


9.1. ,

.
(9.2.1), n
?
9.2.
:
, n n , (n 1)- ,
(n 1) ?
9.3. m- . m-
n, . . BL (n, m) ,
(9.2.4).
9.4. : , (9.2.13), , , ,
, , ?

191


9.1. ., ., ., . :
: . . 2- . .: , 2005. 1296 .
9.2. / . ., . ., . . 4-
. .: . , 2006. 636 .
9.3. . . Pascal Delphi.
.: , 2004. 496 .
9.4. ., ., . : . . .: , 1979. 546 .
9.5. ., ., . : .
. .: , 2001. 384 .
9.6. . ., . . .
.: , 2006. 296 .

- , . -
, .
-

.

10


, , ,
,
, .
,

.

10.1.
,
. ,

193

10.1.

, , . , Swap_A1,
:
Swap_A1 (a, b)
t b
b a
a t
Return (a, b)
End.

1
1
1

, . .
D ,
( / ) Swap_A1 :
fA1 (D) = 3,

VA1 (D) = 1.

(10.1.1)

, . , ?
Swap_A2 ,
:
Swap_A2 (a, b)
b a+b
a b-a
b b-a
Return (a, b)
End.

2
2
2

Swap_A2 :
fA2 (D) = 6,

VA2 (D) = 0.

(10.1.2)

, Swap_A2
, ,
,
2.
, Swap_A1 Swap_A2 C Lc , VC V0 .
(10.1.1) (10.1.2) ,
.
:
?
13 . .

194

. 10.

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

10.2.
,
.

(a + ib)(c + id) = (ac bd) + i(ad + bc) = g + ih,

g = ac bd,

(10.2.1)

h = ad + bc.

, , ,
g h .
(10.2.1) MultC_A1,
:
MultC_A1 (a, b, c, d; g, h)
g a*c - b*d
h a*d + b*c
Return (g, h)
End.

4
4

, D
, ,
MultC_A1 :
fA1() (D) = 4,

fA1() (D) = 2,

fA1() (D) = 2,

(10.2.2)


(. 2.5), fA1 (D) = 8.
, ,
. . [10.1],

195

10.2.

, g h
. MultC_A2 :
MultC_A2 (a, b,
z1 c*(a +
z2 b*(d +
z3 a*(d g z1 - z2
h z1 + z3
Return (g, h)
End.

c, d; g, h)
b)
c)
c)

3
3
3
2
2

, D
MultC_A2 :
fA2() (D) = 3,

fA2() (D) = 5,

fA2() (D) = 5,

(10.2.3)

fA2 (D) = 13.


MultC_A1 MultC_A2
, ; , Lc
C .
MultC_A2 MultC_A1 , ,
. , , :
( )
MultC_A2
MultC_A1? q r,


. q r,

t()
/:
t() = qt() ,

q > 1,

t() = rt() ,

r < 1,

t() , t() .
t()

(10.2.2) (10.2.3) :
tA1 = 4qt() + 2t() + 2rt() = t() (4q + 2 + 2r),
tA2 = 3qt() + 5t() + 5rt() = t() (3q + 5 + 5r).

4q + 2 + 2r = 3q + 5 + 5r,

q = 3 + 3r,
13*

196

. 10.

, , q > 3 + 3r
MultC_A2 . ,
( , , ) ,
,
, ,
, , r  1 (
),

MultC_A2. : /
,

.
, , . , ,
,
,
,
.
:
t = (q 3 3r)t() ,

q > 3 + 3r.

, ,
. ,
, .
,
, , ,
.

10.3.
,
.
, . .

.

197

10.3.



. :
MaxABC_A1(a, b, c; max)
max a
If b > max
then
max b
If c > max
then
max c
Return (max)
End.

1
1
1 pb
1
1 pc

pb , pc , ,
.
DA , pb ,
(b) (a), 1/2, pc ,
(c), 1/3. ,
,
MaxABC_A1
fA1 (D) = 1 + 1 + 1

1
1
5
+1+1 =3 .
2
3
6

(10.3.1)


, ,
Lc PR;
.

,
. ,
, . MaxABC_A2,
:
MaxABC_A2(a, b, c; max)
If a > b
then
If a > c
then
max a
else
max c
end If
else

1
1 pab
1 pab pac
1 pab pca

198

. 10.
1 pba

If b > c
then
max b
else
max c
end If
end If
Return (max)
End.

1 pba pbc
1 pba pcb

pab , a , b.
. MaxABC_A2
, then
else .
DA ,
, , a , b,
1/2. ,
,
1
2

pab = pba = pac = pca = pbc = pcb = ,


MaxABC_A2
fA2 (D) = 1 +

1
1
1
1
1
1
+ + + + + = 3.
2
4
4
2
4
4

(10.3.2)

MaxABC_A2 , : DA
. ,
Lc .

.
, :
? MaxABC_A2
, MaxABC_A1 ; ,
MaxABC_A2 .

.
, (10.3.2)?
, , ,
. ,
,
, ,
, MaxABC_A2
.

199

10.4.


:
VA1 (D) = VA2 (D) = 0,
V0.
, , , ,

: , ,

.

10.4.
, .
,
. , . .
, .
.
.
, . . SortABC_A1, ,
:
SortABC_A1(a, b, c)
If a > b
then ( a b)
t a
a b
b t
If b > c
then ( b c)
t b
b c
c t
If a > b
then ( a b)
t a
a b
b t
Return (a, b, c)
End.

1
3

1
3

1
3

200

. 10.


. ,

, .

|DA | = (216 )3 = 248 ,
, .
1 , 3 , 2 . ,
3! = 6 , .
(. 10.1),
.
10.1
a

D1

D2

2
3

D3

D4

D5

D6

,
, .
:
fA1 (D1 ) = 3,
fA1 (D4 ) = 9,

fA1 (D2 ) = 6,
fA1 (D5 ) = 9,

fA1 (D3 ) = 6,
fA1 (D6 ) = 12;

(10.4.1)

, D1 ,

(D) = 3, D6 ,
fA1

fA1 (D) = 12. ,


, .
, , (10.4.1)

fA1 (D) =

1
1
(3 + 6 + 6 + 9 + 9 + 12) = 7 .
6
2

(10.4.2)

, SortABC_A1 Lc PR ,

10.4.

201

. ,
SortABC_A1, VC
.
,
. , , ,
,
, .

D4 D5 ,
4 ( ). ,

D6 , SortABC_A1 .
SortABC_A2, ,
(
f = 3 + 4 = 7,
,
):
SortABC_A2(a, b, c)
If a > b
then
If b > c
then ( 321 3 1,
f = 2 + 3 = 5)
t a
a c
c t
else
If a > c
then ( 312 ,
f = 3 + 4 = 7)
t a
a b
b c
c t
else ( 213 2 1,
f = 3 + 3 = 6)
t a
a b
b t
end If
end If
else

202

. 10.

If b > c
then
If a > c
then ( 231
f = 3 + 4 =
t c
c b
b a
a t
else ( 132
f = 3 + 3 =
t b
b c
c t
end If
else ( 123
end If
end If
Return (a, b, c)
End

,
7)

3 2,
6)

f = 2 + 0 = 2)

SortABC_A2 (. )

fA2 (D1 ) = 2,
fA2 (D4 ) = 7,

fA2 (D2 ) = 6,
fA2 (D5 ) = 7,

fA2 (D3 ) = 6,
fA2 (D6 ) = 5;

(10.4.3)

, SortABC_A2

D1 , fA2
(D) = 2,

D4 D5 , fA2
(D) = 7.
,
, (10.4.3)
fA2 (D) =

1
1
(2 + 6 + 6 + 7 + 7 + 5) = 5 .
6
2

(10.4.4)

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

10.4.

203

SortABC_A2
Lc PR , ,
SortABC_A1, VC .
, , SortABC_A2
.
: SortABC_A2
?
SortABC_A2
. , ,
,
.
, ,
SortABC_A2 .
, 1

, 5 ?
2
, , .
:
,
.
,
,
,
hmin = log2 6 = 3.
,
.
SortABC_A2.

,
, .
,
; ,
.
, . . ,
. , -
, .
, , ,
,
. , SortABC_A2

204

. 10.

10.5.
, Lc ,
,
, . . y = xm
m.
, . Pow_A1 :
Pow_A1 (x, m; y)
y 1
For i 1 to m
y y*x
Return (y)
End.

1
1+3m
2m

, x
(, ,
).
fA1 (D) = fA1 (x, m) = fA1 (m) = 5m + 2

(10.5.1)

PR Lc .
n m, ,
fA1 (m) = fA1 (n) = (2n ),
, , Pow_A1 PR exp,
. .
.
, ,
Pow_A1 VC .
, m Pow_A1
,
, , ,
RSA [10.1], , . , ,
RSA m 2768 [10.1].

[10.2], .
m x
[10.2].
, , m = 11,
x11 = x x5 x5 ,

x5 = x x2 x2 ,

x2 = x x,

x = x 1,

205

10.5.

, m x,

1,
m = 0;

(10.5.2)
xm = (xm/2 )2 ,
m = 2k;

(m1)/2 2
x (x
) , m = 2k + 1.
(10.5.2) , f(x, m) = xm :

m = 0;
1,
2
(10.5.3)
f(x, m) = (f(x, m/2)) ,
m = 2k;

2
x (f(x, (m 1)/2)) , m = 2k + 1.
(10.5.3)
Pow_A2(x,m)
(, , ).

, . .
m div 2 = (m 1) div 2 = k,

m = 2k + 1,

k 0,

m .
Pow_A2(x,m)
If (m = 0)( )
1
then
F 1( )
1
else
z Pow_A2(x, m div 2)
2
If (m mod 2) = 0 ( ) 2
then (m )
Pow_A2 z*z
2
( )
else (m )
Pow_A2 x*z*z
3
( x )
end if
end if
Return (Pow_A2)
End.

PR. PR.
(m),

m, 1 (m) 0 (m), [10.3].
n

206

. 10.

m, n = (m).
,

fA2 (n) = (n) = (log2 m),
, , PRpl .
. 9,
[10.3]. , ,
,
(m). , m
:
R(m) = (m) + 1 = log2 m + 2, RV (m) = (m) = 1 (m) + 0 (m),
(10.5.4)
RL (m) = 1, HR (m) = (m) + 1,
R(m) , RV (m) ,
RL (m) , HR (m)
. fR (1) Pow_A2(x,m)
/. Pow_A2(x,m)
(p = 2), ,
(r = 4),
(f = 1) Pow_A2(x,m)
z (l = 1),
fR (1) = 2 (2 + 4 + 1 + 1 + 1) = 18,
, , (10.5.4)

fR (m) = R(m) fR (1) = ((m) + 1) 18.


, , fCL (1) = 2

fCL (m) = RL (m) fCL (1) = 1 2 = 2.


( ) fCV (v) = 7 fCV (v) = 8 , ,
(
0 1); ,
fCV (m) = 8 1 (m) + 7 0 (m).
,
fA2 (m) = 18 (m) + 8 1 (m) + 7 0 (m) + 20.

(10.5.5)

207

10.5.

.
, . . m,
(m) = const. (m) = n m,
1 (m)
(m) = n. 1 (m)
m = 2n1 m = 2n 1. m = 2n1 (
m ), 1 (m) = 1

fA2
(m : (m) = n) = 18n + 8 1 + 7(n 1) + 20 = 25n + 21,

(10.5.6)

m = 2n 1 ( m ), 1 (n) = n,

fA2
(m : (m) = n) = 18n + 8n + 20 = 26n + 20.

(10.5.7)

, . m = 2n 1, m + 1 = 2n ,

(m) = n,

(m + 1) = n + 1,

1 (m) = n,

1 (m + 1) = 1

, ,
fA2 (m) = 26n + 20,

fA2 (m + 1) = 25(m + 1) + 21 = 25n + 46,

fA2 (m) > fA2 (m + 1) m 227 .


,
, , m n
, [10.3]
f A2 (m : (m) = n) = 25,5n + 20,5.

(10.5.8)

,
.
HR (m).
z, , , [10.3],

Vst (m) = HR (m) (2 + 4 + 1 + 1 + 1) = 9 HR (m);
HR (m) (10.5.4),

VA2 (m) = Vst (m) = 9 H(m) = 9log2 m + 18,

(10.5.9)


:

(m) = (log2 m), (log2 m).

208

. 10.

, Pow_A2 , ,
.
x, . , , n = 11, x11 = x8 x2 x1 , :
x2 = x x, x4 = x2 x2 , x8 = x4 x4 .
m,
x y x,
m .
Pow_A3,
Pow_A3(x, m; y)
z x1
y 11
Repeat
If (m mod 2) = 1
then (1 )
y y*z
( x)
end If
z z*z
( )
m m div 2
( )
Until m = 0
Return (y)
End.

2 (m)
2 1 (m)
2 (m)
2 (m)
1 (m)

, :
fA3 (n) = 2+(m)(2 + 2 + 2 + 1)+1 (m)2 = 7(m)+21 (m)+2. (10.5.10)
m, (m), (y y*z)
,
1 (m). ,
m = 2k ,
1 (m) = 1 fA3 (m) = 7(m) + 4,
m = 2k 1,
1 (m) = (m)

fA3 (m) = 9 (m) + 2.


m [10.3]
f A3 (m) = 7(m) + 2s (m) + 2 = 8 log2 m + 2.

(10.5.11)

209

10.6.

Pow_A3
,
 (m) = (log2 (m)), (1).

, Pow_A3
, Pow_A1 Pow_A2
m 29.

10.6.

,

x1 = 1, n
a. [10.3]


1
a
.
(10.6.1)
xn+1 = xn +
2

xn

,

. ,
,
= 1020 .
,
a 1, , (10.6.1),
, , .
, . , Sqrt_A1,
(10.6.1),
Sqrt_A1 (a, eps)
x1 1.0
x2 0.5*(x1+a/x1)
Repeat
x1 x2
x2 0.5*(x1+a/x1)
Until (x1-x2) < = eps
Return (x2)
End.

1
4
1
4
2

, , , (10.6.1), .
14 . .

210

. 10.

xn , ,
n, ,
a, . . n = n(a, ).
= 1020 ,
.
. 10.2.
10.2
a

n = n(a, 1020 )

1,00E+02

1,00E+03

10

1,00E+04

11

1,00E+05

13

1,00E+06

15

1,00E+07

16

1,00E+08

18

1,00E+09

20


n(a, 1020 ) = n (a) = b log2 a + c,
b = 0,5002
c = 4,7123; , ,

n (a) log2 (26,231 a),



a. , , a = 1050

88,

log2 (26,231 1050 ) 87,7614.


Sqrt_A1 (, ):
fA1 (a) = 5 + 7(n (a) 1) 3,5log2 a + 31.

(10.6.2)

(10.6.2) ,
Lc PR,
a,
a.
PRpl PR.
,
, , n(a, ) a .

10.6.

211

,
a . n(a, )
n(a, ) = h(a) + g().

(10.6.3)

:
( a 1)
a a , h(a) ,
a , g() (10.6.1).
.
.


[10.4].
, ,
, , , . .
. a ,
, , 64, 8.
, [1, 64)
.
:

f(x) = x, y = a0 + a1 x, a = 1, b = 64;
64,
[10.4], ,

a (a0 + a1 a) = L,

(10.6.4)
d (a0 + a1 d) = L,

b (a0 + a1 b) = L;
a, b, d , d f  (d) a1 = 0. a0 , a1 :
(10.6.4) ,
a1 =

81
1
= ;
64 1
9

(10.6.5)

f  (d) a1 = 0 d = 20,25; (10.6.4),




1
1
1
1 + 4 = 2a0 +
1 + 20 ,
2

14*

212

. 10.


a0 =

113
.
72

L
, , L = 0,6805(5).
,
= 1020
(10.6.1)
1
9

x1 = a +

113
,
72

(10.6.6)

1 a < 64. a ,
.
, a , , 64.
m(a), a : 1 a 64,
a:


log2 a
1.
(10.6.7)
m(a) = log64 a 1 =
6

,
[1, 64), (10.6.6)
,
= 1020 , 8m(a) .
, .
, Sqrt_A2,
Sqrt_A2 (a)
m 1
While (a => 64)
a a/64
m m*8
end While
x (1/9)*a+(113/72)
For j 1 to 5
x 0.5*(x+a/x)
end For
x x*m
Return (x)
End.

1
1
2
2
5
1+35
4
2

213


Sqrt_A2
fA2 (a) = 1 + 5m(a) + 1 + 5 + 1 + 5(3 + 4) + 2 = 5m(a) + 45,
, (10.6.7),


log2 a
+ 40.
fA2 (a) = 5
6

(10.6.8)

, Sqrt_A2 : , a = 1028 . 1 a 10
,
Sqrt_A2 .
, Sqrt_A1, Sqrt_A2
Lc , PR PRpl .

, VC
.


10.1. , , 10.2, , ,
.
10.2.
.
,
, 10.3, .
10.3. ,
. , ,
( 10.4) . ?
.
10.4.
(, . .).
10.5?
10.5. 256,
16. [1, 256). 1020
-

214

. 10.

.

.


10.1. . . . : . .:
-, 2002. 496 .
10.2. ., . : . . .:
, 1999. 720 .
10.3. . ., . . .
.: , 2006. 296 .
10.4. / . ., . ., . .
4- . .: . , 2006. 636 .

11
-



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

. ,

,

.

11.1.

,
, .

, , . .

. ,
,
Max_A0 (S,n; Max,iMax)
Max S[1]
iMax 1
For i 2 to n
If Max < S[i]
then
Max S[i]

2
1
1 + 3 (n 1)
2 (n 1)
2m

216 . 11.
iMax i
end For
Return (Max,iMax)
End.

1m

n Ln ,
, - (
NPR, NPRS).
, .
,
, then, Max S[i]
iMax i. ,
Max_A0, m, , .
. m , , m = n 1,
,
. :
fA (n) = 2 + 1 + 1 + (3 + 2)(n 1) + 3(n 1) = 8n 4 = (n). (11.1.1)
. m
(m = 0) , . :
fA (n) = 2 + 1 + 1 + (3 + 2)(n 1) = 5n 1 = (n).

(11.1.2)

. ,
Max S[i]. ,
.
,
. , k- , ,
k . , , ,
k , ,
, , 1/k. m m.

217

11.1.

, n , m,
,
m=

n

1
= Hn 1 ln n + 1,
k
k=2

Hn n- , 0,57 [11.1]. , .
Hn n [11.1]
Hn = ln n +

1
1

+ O(n3 ).
2n
12n2

, ,
n! , ,
, m
n Hn 1
( , , . [11.2]), Hn ;
fA (n) = 1 + (3 + 2)(n 1) + 3(ln n + ) = 5n + 3 ln n 4 + 3 = (n).
(11.1.3)
,
, . .
.
,
Max_A0.
MinMax_A1 (S,n; Max,Min,iMax,iMin)
Max S[1]
iMax 1
Min S[1]
iMin 1
For i 2 to n
If Max < S[i]
then
Max S[i]
iMax i
If Min > S[i]
then
Min S[i]
iMin i
end For
Return (Max,Min,iMax,iMin)
End.

2
1
2
1
1 + 3 (n 1)
2 (n 1)
2m
1m
2 (n 1)
2m
1m

218 . 11.

,

, ,
, . ,
fA1 (n) = 1 + (3 + 2 + 2)(n 1) + 3(ln n + ) + 3(ln n + ) =
= 7n + 6 ln n 6 + 6 = (n).

(11.1.4)

, ; ,
.
, ? , :
1. , , (n), , MinMax_A1
, ?
2. ,
, . .
7 (11.1.4)?

, . .

, , (n)
.
(11.1.4), , ;
, , .
, .
,
,
, . , - , :
, . ,
, :
MinMax_A2 (S,n; Max,Min,iMax,iMin)
Max S[1]
iMax 1
Min Max
iMin 1
i 1 + (n mod 2)
Repeat
si S[i]
sj S[i+1]

2
1
1
1
3
2 (n/2)
3 (n/2)

219

11.1.
If Si < Sj
then
If Max < Sj
then
Max Sj
iMax i+1
If Min > Si
then
Min Si
iMin i
else
If Max < Si
then
Max Si
iMax i
If Min > Sj
then
Min Sj
iMin i+1
end If
i i+2
Until i > n
Return (Max,Min,iMax,iMin)
End.

1 (n/2)
1 (1/2) (n/2)
1 m1
2 m1
1 (1/2) (n/2)
1 m3
1 m3
1 (1/2) (n/2)
1 m2
1 m2
1 (1/2) (n/2)
1 m4
2 m4
2 (n/2)
1 (n/2)

,

.
, ( 1/2).
,
(,
n/2 , (n 1)/2 ),
(i)
. ,

, , ,
; ,

m1 + m2 = m3 + m4 = H(n1)/2 1,

m1 + m2 = m3 + m4 = Hn/2 1,

( ,
: m1 = m2 = m3 = m4 )

220 . 11.

 
n
+
fA2 (n) 2 + 1 + 1 + 1 + 3 + (2 + 3 + 1 + 2 + 2 + 1)
2



 

1
1
n
1
1
n
ln + 1 + 3 + 2
ln + 1 =
+ 2 +3
2

= 5,5n + 5 ln n 5 ln 2 + 5 + 2 5,5n + 5 ln n + 2,38 = (n).

(11.1.5)

(11.1.5) , (1)
. fA2 (2n) fA2 (2n + 1)
.
(11.1.3) (11.1.5), ,
, . (11.1.4) (11.1.5)
,
,
, ( ).
,
 (A) = (n), (n),
, , , .
(1).

11.2.
, ,
,
. ,
, fA (D).

,
, , .
. C ( ),

, . . .
n, , ,
.
, , ,
,

11.2.

221

. , .
, .
, , Ln .
, C,
. Count_A1, ,
:
Count_A1 (C,n)
( 1)
p 1
1
For i n downto 1
1+3n
sm C[i] + p
3n
C[i] sm mod 2
3n
p sm div 2
2n
end For
C[0] p
2
Return (C)
End.

, , - ( N),

:
fA1 (n) = 11n + 4 = (n).

(11.2.1)


,

. ,
. Count_A2, ,
, :
Count_A2 (C,n)
( 1)
p 1
1
i n
1
Repeat
sm C[i] + p
3k
C[i] sm mod 2
3k
p sm div 2
2k
i i - 1
2k
Until p = 0
1k
Return (C)
End.

222 . 11.

k , .
, , C.
,
.
Count_A2 , , ,
, . . C[n] = 0.
2n 1, ,
, . ,
- NPR.
,
.
,
,
(. 8.4). ,
,

. ,
k
2n , 0 2n 1,
. k

. 11.1, .
11.1

0000 (0)

0001 (1)

0001 (1)

0010 (2)

0010 (2)

0011 (3)

0011 (3)

0100 (4)

0100 (4)

0101 (5)

0101 (5)

0110 (6)

0110 (6)

0111 (7)

0111 (7)

1000 (8)

1000 (8)

1001 (9)

1
2

1001 (9)

1010 (10)

1010 (10)

1011 (11)

1011 (11)

1100 (12)

223

11.2.

k = 1
1/2; k = 2 , ...01, 1/4; k = 3
( ...011) 1/8, . .,
 
k = n + 1,

1
2

k(n) k
2n , 0 2n 1, n:
1
2

1
4

1
8

k(n) = 1 +2 +3 + . . .+(n+1)

 n
1
2

n+1  k

1
n+1
k
+ n+1 . (11.2.2)
k=1

(11.2.2)
[11.3] :
0 < x < 1

kxk =

k=1

x
,
(1 x)2

x = 1/2
 k

1
k
= 2.
k=1

(11.2.3)

(11.2.2), , n ,
n .
(11.2.2) , n = 10
k(10) = 1,999023 ,
k(n) 2 n 10. ,

n 10. Count_A2
fA2 (n) = 2 + 11 k(n) = 2 + 11 2 = 24.

(11.2.4)


, n 10
. ? ,
.
11.1, ,
, ,
. Count_A3:

224 . 11.
Count_A3 (C,n)
i n
While (C[i] = 1)
C[i] 0
i i - 1
end While
C[i] 1
Return (C)
End.

1
2 + 2 (k 1)
2 (k 1)
2 (k 1)
2

Count_A3
()
. , ,
,
. (k 1) ,
k C,
. (11.2.3) Count_A3
fA3 (n) = 5 + 6 (k(n) 1) = 5 + 6 = 11.

(11.2.5)

, Count_A3 11

. ,
Count_A2
!
, Count_A3
-
.
, Count_A2 Count_A3

 (A) = (1), (n),
, , . ,
,
 (A) = (1), (1).

Count_A3 0 2n 1
,
1/2, (
) . , , ,
. n

11.3.

225

, 2n . Count_A3
- (n), (1).
11.2
n

Fth (A1)

Fe (A1)

Fth (A2)

Fe (A2)

Fth (A3)

Fe (A3)

10

114,00

114,00

24,00

23,892

11,00

10,941

12

136,00

136,00

24,00

23,967

11,00

10,982
10,994

14

158,00

158,00

24,00

23,990

11,00

16

180,00

180,00

24,00

23,997

11,00

10,998

18

202,00

202,00

24,00

23,999

11,00

10,999

20

224,00

224,00

24,00

23,999

11,00

10,999

. 11.2 , . Fth
, Fe .

11.3.



, , ,
.


.

.
.
,
. . ,
,
.

, .
, , . . ,
15 . .

226 . 11.

.
:
Sort_Ins_A1 (A,n)
For i 2 to n
key A[i]
j i-1
While (j > 0) and (A[j] > key)
A[j+1] A[j]
j j - 1
end While
A[j+1] key
end For
Return (A)
End.

1 + 3 (n 1)
2 (n 1)
2 (n 1)
4+4k
4k
2k
3 (n 1)

n Ln ,
, - ( NPR,
NPRS). k , While,
. , While
, ,
, . . . ,
[11.4], ,
. , i- , (i 1) ,
i .
(i 1)/2
, While

n

X
i1
n2
n
k=
=
.
i=2

, ,
While ,
f A1 (n) = 1 + (n 1) (3 + 2 + 2 + 4 + 3) + (4 + 4 + 2)

n2
n

4
4


=

= 2,5n2 + 11,5n 13. (11.3.1)

11.3.

227

, . ,
, .
. 11.3 ,
10 000 , (Fth
(11.3.1), Fe , d% ).
11.3
n

Fth

d%

Fe

73,00

73,09

0,1233 %

239,00

239,20

0,0837 %

16

811,00

810,92

0,0099 %

32

2 915,00

2 917,63

0,0902 %

64

10 963,00

10 962,09

0,0083 %

128

42 419,00

42 419,06

0,0001 %

256

166 771,00

166 782,82

0,0071 %

512

661 235,00

661 249,14

0,0021 %



 (A) = (n2 ), (n),
, .
(1).
. . , , .
, ,
.
. ,
, , 17, 17-
.
, , .
. , , , 1000, ,
15*

228 . 11.

999 . ,
M m + 1, M = max{ai }, m = min{ai }.
:
;
;
;
d = m 1.

:
Sort_Ind_A2 (A,n)
Max A[1]
Min A[1]
For i 2 to n
If Max < A[i]
then
Max A[i]
If Min > A[i]
then
Min A[i]
end For
d Min - 1
L Max - Min + 1
For i 1 to L
B[i] 0
end For
For i 1 to n
B[A[i]-d] 1
end For
i 1
For j 1 to L
If B[j] = 1
then
A[i] j + d
i i + 1
end For
Return (A)
End.

2
2
1 + 3 (n 1)
2 (n 1)
2m
2 (n 1)
2m
2
3
1+3L
2L
1+3n
4n
1
1+3L
2L
3n
2n

,
L, .

11.1, .

11.3.

229

,
:
fA2 (n, L) = 7n + 4 ln n 6 + 4 + 5 + 1 + 5L + 1 + 7n + 1 + 1 + 5L + 5n =
= 10L + 19n + 4 ln n + 3 + 4. (11.3.2)
,
, .
, n L
.

 (A) = (n + L), (n + L),
, . (L).
.

, ,
(1), (ln n) .
, Sort_Ins_A1
Sort_Ind_A2,
2,5n2 + 11,5n = 10L + 19n,
L,
1
4

3
4

L(n) = n2 n.

(11.3.3)

, L, n , ,
. 11.1.

. 11.1.
.

L (11.3.3) -

230 . 11.

. , n = 100
L 2425, . .
2425,
(, ), .

11.4.

.

.
RSA, 1977 .
, [11.5]. , RSA
: ( , ) , (), .
: .
RSA
, , ,
. ,
, . ,
, () .
, .
, , ,
.
,
, , . RSA ,

.

RSA. p q. ,
, , . .
(
512 ), (p 1) (q 1)
. n = pq,
, (n) = (p 1)(q 1).
e, (n), d, ,

11.4.

231

ed = 1 mod (n). d
. (e, n),
(d, n). x y = xe mod n, y
x = yd mod n [11.5].
, RSA .
,

.
(Mult_A1). , ,

, . .
.
,
.
,
Mult_A1. A B n-
, 2n C. Mult_A1
Mult_A1(n,A,B,C)
(A, B n)
(C 2n)
n2 n*2
2
For i l to n2
1+32n
C[i] 0
22n
end for
For jb n downto 1
1+3n
( B; m
B)
If B[jb] = 1
2n
then (: C = C + A*2**(n-jb))
p 0
m
jc n + jb
2m
For ja n downto 1
m (1 + 3 n)
s C[jc] + A[ja] + p
5mn
C[jc] s mod 2
3mn
p s div 2
2mn
jc jc - 1
2mn
end for
C[jc] p
2n
( )
end if
end for
End.

232 . 11.


n
B, . . m = n/2.
, , ,
,
1
2

f A (n) = 4 + 15n + (6n + 15n2 ) = 7,5n2 + 18n + 4.

(11.4.1)

,
( )
, . . .
(Mult_A2).
, .
. . [11.6] 1962 .
n- , , ,
(n2 ).
. a, b
n- , . .
. n , n = 2k
n
. nh n/2. ,
, , a, b

a = 2nh a2 + a1 , b = 2nh b2 + b1 ,
a1 , a2 , b1 , b2 , nh = n/2 (),
a2 , b2 nh a, b. a b
, ,
. . :
a b = 2n a2 b2 + 2nh ((a1 + a2 ) (b1 + b2 ) (a1 b1 + a2 b2 )) + a1 b1 .
(11.4.2)
(11.4.2) ,
, nh, a1 , a2 , b1 , b2 n-
. a1 + a2 , b1 + b2 (nh + 1)
.
a3 , b3 nh a4 , b4 :
a1 + a2 = 2 a3 + a4 ,

b1 + b2 = 2 b3 + b4 ,

(a1 + a2 ) (b1 + b2 ) = 4 a3 b3 + 2 a4 b3 + 2 a3 b4 + a4 b4 , (11.4.3)

11.4.

233

a3 b3 nh, a4 b4
(11.4.3) ,
nh- ,
. ,
n-
, nh = n/2 .
Mult_A2. , . .
, .
, ,
n n/2 , (11.4.2),
(n) ,
, (11.4.3). , , ,
. n = 1,
a b , C.
,

:

fA (1) = C;
fA (n) = 3 fA (n/2) + (n).
(,
, ),
fA (n) = (nlog2 3 ),

nlog2 3 n1,5849 ,

(11.4.4)

(n2 ).
, ( )
[11.7] fA (n) = (n ln n ln ln n).
Mult_2. , ,
[11.8] :
f A2 (n) = 667,5nlog2 3 281n 352,5,

(11.4.5)

, , .
, , .
,

234 . 11.

- . , ,
,

f A2 (n) = 322,5nlog2 3 281 n 46.

(11.4.6)


(Mult_2) Mult_1, ,
. . 11.4,
Mult_1 (11.4.1), Mult_2 (11.4.6), = f A2 (n) f A1 (n).
11.4
n

f A1 (n)

f A2 (n)

8150

498 315 454,0

507 707 088,0

9 391 634,0

8200

504 447 604,0

512 660 987,5

8 213 383,5

8250

510 617 254,0

517 632 638,7

7 015 384,7

8300

516 824 404,0

522 621 996,7

5 797 592,7

8350

523 069 054,0

527 629 017,3

4 559 963,3

8400

529 351 204,0

532 653 656,4

3 302 452,4
2 025 016,5

8450

535 670 854,0

537 695 870,5

8500

542 028 004,0

542 755 616,4

727 612,4

8550

548 422 654,0

547 832 851,1

589 802,9

8600

554 854 804,0

552 927 532,1

1 927 271,9

8650

561 324 454,0

558 039 617,3

3 284 836,7

Mult_A2,
,
8550. ,
, [11.8].

:
,
. , ,
15002000 [11.9].
,

, .
.

11.5.

235

11.5.

,
,

.
. [11.10],

(). , , 20 ,

.
,
, ,
[4].
,
()

: - [11.11].
.
(),

2 64 . . 4 ( );
,
16 384 ( 64 ).

, .
4096, ,
,
4000 16 000.
,
, ,
,
4000 16 000.
.
,
: ,
-.

236 . 11.


[11.12] , ,
(ln n), n .
[11.12] (ln ln n),
,
.


-, , [11.7]. -
h(K) = (K2 + K + 1) mod M,

(11.5.1)

M - , K
[11.7]. ,

.
,
[11.7],
, ,
. -
.
:
-
1/M,
n



1 n
= 1
,
(11.5.2)
M

, ln(1 x) = x
x, ,
en/M .

(11.5.3)

n = 2 M, 0,135335,

- .
.
. t (key), key ,

11.5.

237

.
Ne
, [11.13], = 0,95
Ne
Ne = 3,8416

V2
,
2

(11.5.4)

V ,
. t (n) 1000,
0,001,
t (n).
Ne , (11.5.4), 38000
56000
. t (n) Ne
n.
4000 n 16000
n = 250 10-
, .

, 50 %.
Ne
,
,

.
Borland Delphi 7.0 Microsoft Windows XP
Professional, :
Intel Pentium III 800 ;
- ,
800 , 256 ;
512 ,
133 .
.

[11.7].
, , ,

238 . 11.

. 5 30
.

. 11.2.

. 11.2.
, .

, 11 20
.
. [4000, 16 000] , ,
,
.
. 11.3.
.
. ,
Delphi, .
,
20, .
,

11.5.

239

. 11.3.
, , , , .

, .
,
,
, .
Function FindInterpolated (AVal: Extended) : Longint;
var
i, iFrom, iTo: Longint;
Begin
Result := 0;
iFrom := 0;
iTo := DataLen; // Data
// SLevel=20
While (iTo-iFrom) > SLevel do
begin
//
If (AVal < Data[iFrom]) or (AVal > Data[iTo])
then
exit;
//
i := iFrom +
Round(((iTo-iFrom)*(AVal-Data[iFrom]))/
(Data[iTo]-Data[iFrom]));
If Data[i] < AVal
then
iFrom := i+1 //
else
If Data[i] > AVal
then
iTo := i-1 //
else

240 . 11.
begin
Result := i; //
exit;
end;
end;
Repeat //
If (Data[iFrom]=AVal)
then
begin
Result := iFrom;
break;
end;
iFrom := iFrom+1;
until iFrom > iTo;
End;

- ,
, .
// -
Function Hash(AVal: Extended): Longint;
begin
AVal := AVal*HashLen; // HashLen -\
Result := Round(AVal*AVal+AVal+1) mod HashLen;
end;
Function FindHash(AVal: Extended): Longint;
var
v: Longint;
p: PHashRec;
Begin
Result := 0;
v := Hash(AVal); // -
P := @HashData[v]; // P -
Repeat
If (P.V = AVal)
then
begin
Result := v; //
break;
end;
P := P.Next; //
until P = nil; //
End;

. D, n,
. ,
n, Dn .

11.5.

241

n N = |Dn |, , :
Dn = {D(j) | |D(j) | = n, j = 1, N},

(11.5.5)

N  1 n > 0. D Dn t (D),
, D. ,
t (D) . t (D)

t
(n) t (D) t (n),

t
(n)

(11.5.6)
t
(n)

,
Dn .

Tn (m) =

X(m)
,
N

m [t
(n), t (n)],

(11.5.7)

X(m) Dn ,
t (D) = m, . . m,
,
Dn .
Tn (m) Tn ,
Tn ,
n. Tn (m)

. ,
Tn (m).
Tn (m)
Tn (m),
. Tn (m) . 11.4, Tn (m)
. 11.5 11.6. 16 106 n.
, , ,

. . 11.5 11.6 , Tn (m)
, . ,
2500
16 . .

242 . 11.

. 11.4.
.

. 11.5.
.

. 11.6.

.


.
. ,
, . .
.
,
, . -

11.5.

243

A (. 4)
i (n) = VA (n) QA (n),

0 i (n) 1,

(11.5.8)

VA (n) ,
VA (n) =

(n)
,
t (n)

0 VA (n) 1,

(11.5.9)

QA (n) ()
n,
, . .
QA (n) =

t
(n) t (n)
.

t (n) + t
(n)

(11.5.10)

i (n)
. 11.7.
, .

. 11.7.
.

. , ,

:

-;
16*

244 . 11.


;

.


11.1. ,
.
MinMax_A2 11.1.
?
11.2. , k-
.
, .
11.3.
, .
,
.
11.4.
, , .
11.5. 11.3
Sort_Ind_A2 ,
?
11.6. . , ,
11.3 . ,
, .
11.7.
, . .
.
11.4,
?
11.8. ,

245


11.1. ., . . .:
, 1987. 120 .
11.2. . . . . 1. :
. . 3- . .: , 2002. 720 .
11.3. . : . .
.: , 2005. 400 .
11.4. ., . :
. .: , 1981. 368 .
11.5. . . . : . .:
-, 2002. 496 .
11.6. http://www.mpei.ac.ru/homepages/mm/Lab/A1496/fomich/algs.htm.
11.7. ., ., ., . :
: . . 2- . .: , 2005. 1296 .
11.8. . ., . . .
.: , 2006. 296 .
11.9. ., ., . :
. . .: , 2001. 384 .
11.10. . ., . .
, , //
. 2006. 1. . 5056.
11.11. Weikum G., Wossen G. Transactional information systems. Theory,
algorithms, and the practice of concurrency control and recovery.
Academic Press, 2002. 852 pp.
11.12. . . . .3. : .
. .: , 2003. 400 .
11.13. . . . .: -
, 2004. 212 .

12
-

, , ,

. ,
- ,
.

-
, ,
- , ,

.

12.1.
( 6.1) ,
. , .
,

,
.
,
, .

12.1.

247

,
.
.
,
. . , ,
.

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

;
: ,
,
. ,
,
, . .
.
, , . . , . ,

.
(Merge) A, p r r+1
q. Bp Bq
r p + 2 q r + 1,
.
Bp Bq,
A p q.
.

248

. 12.

Merge (A,p,r,q)
( )
max A[r]
If max < A[q]
then
max A[q]
end If
( Bp, Bq)
p1 p - 1
kp r - p1
For i 1 to kp
Bp[i] A[p1+i]
end For
Bp[kp+1] max ()
kq q - r
For i 1 to kq
Bq[i] A[r+i]
end For
Bq[kq+1] max ()
( )
pp 1
pq 1 ( )
For i p to q
If Bp[pp] < Bq[pq]
then
A[i] Bp[pp]
pp pp + 1
else
A[i] Bq[pq]
pq pq + 1
end If
end For
End.

2
2
2
2
2
1 + 3 kp
4 kp
3
2
1 + 3 kq
4 kq
3
1
1
1+3m
3
3
2
3
2

, [12.1], , m. m = kp + kq = q p + 1
.
, , max A[q]
,
:
f merge (m) = 2 + 2 + 1 + 2 + 2 + 1 + 3 kp + 4 kp + 3 + 2 + 1 +
+3 kq + 4 kq + 3 + 1 + 1 + 1 + 3 m + m (3 + 5) =
= 11 m + 7 (kp + kq) + 23 = 18 m + 22. (12.1.1)
,
, , if Bp[pp] < Bq[pq]

12.1.

249

, , ,
then else, , ,
.
max A[q]
, .
NPR, NPRL,
N.
. MSort_A1
A p q,
, .


MSort_A1 (A,p,q)
If p = q ( )
1
then
r (p+q) div 2 ( )
3
MSort_A1 (A,p,r) ( )
MSort_A1 (A,r+1,q) (
)
Merge(A,p,r,q) ( )
Return (A)
End.


A, n , MSort_A1(A,1,n).
.
.

. , : n = 2k , k = log2 n.
, n ,
,
.
,
k n .
[12.1].
k,
n . R(n)

:
R(n) = 1 + 2 + + 2k = 2 2k 1 = 2n 1.
n = 2k ,
RL (n) = n, , , RV (n) = n 1.

250

. 12.

n :
R(n) = 2n 1,

RV (n) = n 1,

HR (n) = 1 + log2 n,

BL (n) =

RL (n) = n,
n
.
2n 1

(12.1.2)


MSort_A1 / fR (1). MSort_A1
(p = 3),
(r = 4),
(f = 0) , MSort_A1
r (l = 1),
fR (1) = 2 (3 + 4 + 0 + 1 + 1) = 18,
, , (12.1.2)
fR (n) = R(n) fR (1) = (2n 1) 18 = 36n 18.

(12.1.3)

;
, fCL (1) = 1, ,
fCL (n) = RL (n) fCL (1) = n 1 = n.

(12.1.4)

( ) , Merge fMsort (v),


fMerge (v) Merge.
fCV (v)
fCV (n) :
fCV (v) = fMsort (v) + fMerge (v),

fCV (n) = fCV Msort (n) + fCV Merge (n).

fMsort (v) ,
, (r+1),
r (l = 1), Merge, , ; ,
fMsort (v) = 1 + 3 + 1 + 2 (4 + 4 + 0 + 1 + 1) = 25,
fMsort (v)
fCV Msort (n) = RV (n) fMsort (v) = (n 1) 25 = 25 n 25.

(12.1.5)

g(vj ), ,
vj : g(vj ) = fMerge (vj ). -

12.1.

251


.

RX
V (n)

g(vj ),

j=1

, ,
. m (12.1.1) 18 m + 22
RV (n) = n 1 , g(vj )

g(v1 ) = 18n + 22;

g(v ) = g(v ) = 18 n/2 + 22;


2
3

g(v
)
=
g(v
4
5 ) = g(v6 ) = g(v7 ) = 18 n/4 + 22;

...
g(vj ) ,
fCV Merge (n) =

RX
V (n)

g(vj ) = 22 RV (n) + 18 n + 2 18 n/2 + 4 18 n/4 + . . . ,

j=1

, ,
, , . . k
0 k 1,
fCV Merge (n) = 18nk + 22 (n 1) = 18n log2 n + 22n 22.

(12.1.6)

(. (12.1.3)(12.1.6)),

n = 2k :
f A (n) = fR (n) + fCL (n) + fCV Msort (n) + fCV Merge (n) =
= 36 n 18 + n + 25 n 25 + 18 n log2 n + 22 n 22 =
= 18 n log2 n + 84 n 65. (12.1.7)

FR (n) =

fR (n)
36n 18
=
.
fA (n)
18n log2 n + 84n 65

(12.1.8)

FR (n) : ,
n = 1024 FR (n) 0,136, n = 1048576
FR (n) 0,08, 815 %.
(12.1.7), ,
(n log2 n), -

252

. 12.

.
, P, . .
. ,
, .

, ,
,
2 .
,
fA (n) = f A (n) 1 RV (n) = 18 n log2 n + 83 n 66.
fA (n) = f A (n) + 1 RV (n) = 18 n log2 n + 85 n 64.
, NPRL
.
.
MSort_A1 , .
,
Sort_Ins_A2 (. 11.3).
(. (11.3.1))
f A2 (n) = 2,5n2 + 11,5n 13 = (n2 ),

,
. , k
,
:
MSort_A3 (A,p,q)
l = q - p + 1
If l > k ( )
then
r (p+q) div 2 ( )
MSort_A3 (A,p,r) ( )
MSort_A3 (A,r+1,q) (
)
Merge(A,p,r,q) ( )
else
( )
Sort_Ins_A2(A,p,q)
Return (A)
End.

.

, -

12.1.

253

,
. ,
,

.
k ,
n

, n
k
k ,
.

f A3 (n, k) = f A1 (n, k) + f A2 (n, k) =


n
n
n
= 18n log2 + 84 65 + (2,5k2 + 11,5k 13),
k




n
n
f A3 (n, k) = 18n log2 n 18n log2 k + 84 65) + (2,5nk + 11,5n 13 .
k

(12.1.9)

,
:
f A3 (n, k)
71n
18n
= 2,5n 2
= 0,
k
k ln 2
k


2,5k2 25,96k 71 = 0,
12,63.
k , 12 13.
,
,
n > 1000 12 13
.
k = 12 (12.1.9)

f A3 (n) = 18n log2 n 16,9n 65.

(12.1.10)


(12.1.7) (12.1.10),
f A (n) 102n.
,
[100, 3000]

254

. 12.


, ,
2,0 100 1,54 3000.

12.2.



.
. [12.2]. , ,

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

.
, ,
, (
) . , ,
,
. , ,
5 7 10 18, 10
, ,
, .
,
,
, .
, .
, , , , .
,

12.2.

255

.
.
. .

Y = {yi },

yi = {vi , ci },

i = 1, n,

yi , , vi ,
, ci ,
.
V. yi
.
V yi :
x = {xi }, x = 1, n,
xi , . . x Enz , xi 0. xi = k k yi
V. , n- Enz .
V Y
,
,
.
:
Pn (x) =

n
X
i=1

xi ci max,

n
X

xi vi V.

(12.2.1)

i=1

(12.2.1) , ,
, x, .
.
, (12.2.1), , , ,
, .

. , British
museum technique .
,
, .

256

. 12.


. n
. m , V,
mnz , (m + 1)n . ,
, 20 (n = 20),
V 9 ,
1020 20- .
,
1000 .
, Enz ,
.
n
Y

(V/vi  + 1) (m + 1)n ,

i=1

m = max{V/vi }.
i=1,n

vi ,
(m + 1)n ,
. , .
, NP-,

n .
.
,
,
V, : gi (xi ) = ci xi .
( ), Pn (x) (. 12.2.1),

.
. , , :

f0 (v) = 0;

f (v) = max{x c + f
m
m
m
m1 (v xm vm )}, m = 1, n,
xm
(12.2.2)

 

.
v = 0, V, xm = 0,
vm

, v .

12.2.

257

fn (V).
f1 (v) (12.2.2),
,
, fm (v) [12.1]:
 

f
c1 , m = 1;
(v)
=
1

v1

fm (v) = max{xm cm + fm1 (v xm vm )}, 2 m n,


(12.2.3)
xm




0 v V, xm = 0,
.
vm

[12.2] , , (12.2.2), , ,
.
. (12.2.3) (12.2.1) . ,
(12.2.3),
m = 1, f1 (v)
. m 2
v m
(m 1)
. A1(V,x),
.
A1(V,x)
(V )
(x )
(boxV[1..n], boxC[1..n] )
If x=1
then ( x=1)
k V div boxV[1]
A1 k*boxC[1] ( V 1-
)
else ( max F)
Max 0
k V div boxV[x]
For i 0 to k ( )
Cost i*boxC[x]+A1(V-boxV[x]*i,x-1)
If Cost > Max
then
Max Cost
Optx i ( x
V)
end for
17 . .

258

. 12.

A1 Max ( )
end (If)
Return (A1)
End.

.
.
, V = 10.
vi ci . 12.1.
12.1

i

vi

ci

f3 (10), ,
. 12.1.

. 12.1. , .

.
. ,
, ,
, .
(12.2.3) ,
n, V, v1 , . . . , vn ,
.
, [12.1],
k=

V
,
v

v=

n
1 X

vi ,
n
i=1

12.2.

259

, V. , ,
V, ,
, k .
. ,
boxC[1..n]
boxV[1..n]. XArr[1..n,0..n],
;
XArr[x,1..n] ,
XArr[x,0] . XArr[x,0]
. ,
x
XArr[x-1,0..n],
XArr[x,0..n].
. , ,
A1(V,x) (
).
A1(V,x)

(V )
(x )
(boxV[1..n], boxC[1..n] )
(XArr[1..n,0..n] )
If x=1
1
then ( )
k V div boxV[1]
3
XArr[1,0] k*boxC[1]
5
( x = 1)
XArr[1,1] k
3
For j 2 to n
1 + 3 (n 1)
XArr[1,j] 0
3 (n 1)
end for
else ( max F)
( )
For j 0 to n
1 + 3 (n + 1)
XArr[x,j] 0
3 (n + 1)
end for
k V div boxV[x]
3
( )
For i 0 to k
1 + 3 (k + 1)
A1(V-boxV[x]*i,x-1)
4k
Cost i*boxC[x] + XArr[x-1,0]
7k
17*

260

. 12.

If Cost > XArr[x,0]


then
( x-1)
For j 1 to n
(XArr[x,j] XArr[x-1,j]
XArr[x,x] i
XArr[x,0] Cost
end for
end for
end (If)
End.

3k
1+n3
6n
3
3

.
, ,
, , k,
.

.
R(n, k) ,
n k. n k.
k = 1 k = 2, R(n, k)
. 12.2 12.3.

. 12.2. k = 1.

. 12.3. k = 2.

261

12.2.

R(n, k), ,
. 12.4.

. 12.4. .

, R(n, k)
, . . . m j , , n k, ,

n1
R(n, k) = Cn+k
.

(12.2.4)


(, ,
RV (5,2) = R(4,2)), , ,
RV (n, k) RL (n, k).
,

R(n, k):
k+1
,
n+k
n1
= R(n, k 1)
.
n+k

n1
RL (n, k) = Cn+k1
= R(n, k)
n2
RV (n, k) = Cn+k1

(12.2.5)

, k,
, n. , (12.2.4)
(12.2.5)
,
:
n1
R(n, k) = Cn+k
,

n1
RL (n, k) = Cn+k1
,

HR (n) = n,

BL (n, k) =

n2
RV (n, k) = Cn+k1
,

k+1
.
n+k

(12.2.6)

262

. 12.

. , , . . fA = fA (n, k). fR (1)


/. A1(V,x)
(p = 2),
(r = 4), (l = 4),
(, )
fR (1) = 2 (2 + 4 + 0 + 4 + 1) = 22,
, ,
n1
fR (n, k) = 22 R(n, k) = 22 Cn+k
.

(12.2.7)

fCL (1)
(6n + 6) ;
, fCL (1) = 6n + 7, ,
n1
fCL (n, k) = RL (n, k) fCL (1) = (6n + 7) Cn+k1
.


, :
RL (n, k) = L R(n, k),
L =

RV (n, k) = V R(n, k),

(12.2.8)

k+1
n1
, V =
(, L + V = 1); ,
n+k
n+k

fCL (n, k) = (6n + 7) L R(n, k).

(12.2.9)


fCV (n, k) = fCV vec (n, k) + fCV for (n, k),
; ,
fCV vec (n, k) = RV (n, k) fCV vec (v) = (6n + 12) V R(n, k).

(12.2.10)

. , 17 ,
, ,
, , ,
, 17 (R(n, k) 1).
(9n + 7) . then , k.

263

12.2.

, . .
,
. ,
,
. , then
, , .
, , ,
,
.
,
, ,
.

,
:
f = 1,

f = V =

n1
,
n+k

f =

1 + V
k+1
=1
.
2
2 (n + k)

(12.2.11)

, fCV for (n, k), :


fCV for (n, k) = 17 (R(n, k) 1) + (9n + 7) f R(n, k).

(12.2.12)

(12.2.7)(12.2.12) , L + V = 1,

,
k,
f (12.2.11):
fA1 (n, k) = (6n + 9nf )R(n, k)+(46 + 5V + 7f )R(n, k)17. (12.2.13)

FR (n, k) =

fR (n, k)
22

,
fA (n, k)
6n + 9nf + 46 + 5V + 7f

FR (n, k) 0, n .

k , . , [12.3],
,
, , - (s),
:
R(n, k) =

(n + k + 1)
.
(n) (k + 2)

264

. 12.

.

HR (n);
Vst (m) = HR (m) (p + r + f + l + 1),
,
Vst (n) = HR (n) (2 + 4 + 0 + 4 + 1) = 11HR (n) = 11n.
,
XArr[1..n,0..n],
k. :
V(n) = Vram (n) + Vst (n) = n2 + 3n + 11n = n2 + 14n.

n1
), (n2 ),
 (n, k) = (n Cn+k

n k = n 2,
.
.
,
k , NPRH.
(
k = 0), . , k = n 2: n , . (
k)
E.

.

n1
k+1
= Cn+k
,
Cn+k

k+1
Cn+k
= ((n + k)k+1 ),

k  n,

k
n . k ,
, .
.
,

12.2.

265

,
, . [12.3].
.

, V,
.
v yi , i = 1, m,
m n, xm
v , fm (v)
.
.
fn (v) xnv
v 0 V ( ) Y. ,
, ,
, fn (v)
.
. 12.1.
,

1 10, . 12.2.
12.2

v
1
2
3
4
5
6
7
8
9
10

x1
0
1
1
2
2
3
3
4
4
5

f1 (v)
0
3
3
6
6
9
9
12
12
15

v
1
2
3
4
5
6
7
8
9
10

x1
0
1
0
2
1
0
2
1
0
2

x2
0
0
1
0
1
2
1
2
3
2

f2 (v)
0
3
5
6
8
10
11
13
15
16

v
1
2
3
4
5
6
7
8
9
10

x1
0
1
0
0
1
0
0
0
0
0

x2
0
0
1
0
1
2
1
0
3
2

x3
0
0
0
1
0
0
1
2
0
1

f3 (v)
0
3
5
7
8
10
12
14
15
17

, (12.2.3) , -

266

. 12.


.
, ,
,

.

:
A2(boxC,boxV,n,V; f,x)

(boxV[1..n] )
(boxC[1..n] )
(n )
(V )
(f[0..V], f1[0..V]

)
(x[0..V,1..n],x1[0..V,1..n]

)
, 1
for v 0 to V ( )
begin
x[v,1] v div boxV[1] ( 1
v)
x1[v,1] x[v,1]
f[v] x[v,1]*boxC[1]
f1[v] f[v]
end

for i 2 to N ( )
begin
Vi boxV[i]
Ci boxC[i]
for v 0 to V ( )
begin
maxKol 0;
maxC f[v]
z v div Vi (z
i v)
for k 0 to z ( f)
begin
C Ci*k + f1[v-k*Vi]
if maxC < C
then
maxC C
maxKol k
end ( k)

12.2.

267

(
)
f[v] maxC
jr v - maxKol*Vi
i1 i - 1
for j 1 to i1
begin
x[v,j] = x1[v,jr]
end
x[v,i] maxKol
end ( )

(

i )
for v=0 to V
for j 1 to i
x1[v,j] x[v,j]
end (end for)
f1[v] f[v]
end (end for)
end ( )
End.

.

. ,
, , , , k
V.
,
(1),
, .

, , . 12.3.
12.3


0 v 1

v 2 v 1

...

...

(k 1)v kv 1

k1

kv = V

268

. 12.

, ( v)
( k)
V (1) + (1 v + 2 v + . . . + (k 1) v + k) (1) =

k1

X 
k(k 1)
i = (1) V + k + v
. (12.2.14)
= (1) V + k + v
2

i=1

k = V/v,
(12.2.14) :

V
V
V2
+ +
2v
2
v

(1),

, , (n 1) ,

(
)

nV 2
v

= (nVk).

.

, . . ,
, .
:
fA2 (n, V, k) = 8n2 V +6nVk+8n2 +45nV +12nk6Vk+32n31V 12k16.
(12.2.15)
, , ,
.

.
? , n, V, k
(12.2.13) (12.2.15)
. ,
, ,


.
( )
?
.

12.3.

269

,
m ,
(n m) .
, (12.2.13) (12.2.15)
g(m), ( , n, V, k ):
g(m) = fA1 (n m, k) + fA2 (m, V, k).
m
m = arg min g(m).

(12.2.16)

0mn

m , m
g(m); ,
n, V, k:
1. 1: m = 0 m = 1. , ,
,
.
2. 2: m = n. ,
, , .
3. 3: 2 m n 1. ,
m .
,
, n, V, k
m (12.2.16) ,
, .

12.3.



. , , ,
.

. , . , . .

270

. 12.

[12.4], .
. , , . ,
,

. ,
, , ,
,
. ,
.
,
,
. , ,
.
n . ,
.
(n 1) ,
.
(n 2), . . .
, (n 1)! ,
.
. , , n .
C, cij
( ,
) i j. , cij = cji i = j, i, j = 1, n, . .

, , . cii = i = 1, n (
, ).
() ,
, , ( ) C.
. , , .
.

12.3.

271

1. Enz n .
, , .
, ,
, x, . n n(n 1) = n2 n
.
x 0 1, ,
2
, , x 1zn n . n ,
x n , . ,

(xi 0) n

2
. (. . 7) Szn n (0, n).
, ,
, x,
. . N

2

N = {i | i = 1, n},
M
M = {i | i = 1, n2 n}
R+ .
M N N,
v

v(i) = (k, l),

i (k, l) ,
M R+ ,
c

c(i) = cv(i) = ckl ,

()
.
,
f(x) =

2
nX
n

c(i) xi min,

i=1

xi {0, 1},

2
nX
n

xi = n,

x Snz

(0,

n);

i=1

n , x, .

272

. 12.

.
2. En1
z . ,
x,
. ,
En1
z
. ,
; ,
, .

. (k, l), l k,
k, k + 1, . . . , l; ,
(l (k 1))!.
(2, n)
|(2, n)| = (n 1)!

n .
,
. 1, ,
(2, n) , , ,
, .
, x En1

z
2 n, (2, n),

xi {2, n},

i = 1, n 1

xi = xj

i = j.

(12.3.1)

x,
(2, n), zn1 (2, n).
x En1
z ,
(12.3.1)? ,
x
n. , x
En1
z



r=

n
X

n (n + 1) (2n + 1)
1,
6

i2 =

i=2

x Sn1
z (0, r).

, , ,

N N R+ ,
c

c(i, j) = cij ,

c(i, i) = ,

12.3.

273

, . En1

z
:
f(x) = c(1, x1 ) +

n1
X

c(xi1 , xi ) + c(xn1 , 1) min,

i=2

x = (x1 , . . . , xn ) zn1 (2, n).


,
, .
.

.
( ),
, . ,
,
.

, , .
.

.
. ,
, . . R (n 1)! n .
, , , , (k, l), .
,
: , , ,
, , , , .
(k, l), , ,
, R
{(k, l)} {(k, l)}. {(k, l)} R, (k, l), . . , {(k, l)}
, . ,
,
,
n .
. . 12.4
18 . .

274

. 12.

( [12.5]).
,
.
12.4

1

25

40

31

27

17

30

25

19

15

50

24

22

10


, . , (3, 5),
(
).
, . 12.5. ,
1.
- , {(3, 5)}
,
{(3, 5)} , , .
, {(3, 5)}
, R.
(2, 1) 5. {3, 5} , (2, 1), , .
. 12.5.

, ,
. , 2
. 12.5 , (3, 5) (2, 1). ,

.
,
.
, .
,
,

12.3.

275

. 12.5. .

. ,
. . ,
S.
, ,
, S,
, . . , ,
, ,
. ,
, S.
.
.
1.
( ) . ,
,
, .
2. - ( ) h,
h ,
,
.
( ) . t
C. t
z(t) =

cij .

(i,j)t

C C (
), t 18*

276

. 12.

C , z(t) = h + z (t),
z (t) t C .

: ,
hi i-
.
. ( )
hi = 0, ( ) , ( )
( ,
).

C. . 12.5 .
hi (
).
12.5

1

15

h = 25

12

22

20

h=5

18

14

h=1

44

18

h=6

15

h=7

h=0 h=0 h=0 h=3 h=0

h = 25 + 5 + 1 + 6 + 7 + 3 = 47;
, R
47, . .
z(t) = h + z (t) h = 47,
z (t) 0 t C .
. 12.5. ,
, ,
, , , , .
.
. (3, 5)
(5, 3), (3, 5) (5, 3)
, . (5, 3)

12.3.

277

, c53 = . 3 5
{(3, 5)}, 3
5.
h = 15, {(3, 5)}, . 12.6.
, . 12.7.
{(3, 5)} 47 + 15 = 62.
{(3, 5)}
1

15

12

22

44

18

12.6

{(3, 5)}
. (3, 5) ,
c35 = , . 12.5.
{(3, 5)} - 3 5. 3
2, 5
0. , {(3, 5)}
47 + 2 + 0 = 49.
12.7
{(3, 5)}
1

22

41

h=3

15

h = 12 0

{(3, 5)}
. ,
{(k, l)},
.

278

. 12.

, {(3, 5)}
, 62, {(3, 5)} ;
, {(3, 5)} .
{(3, 5)}
49 S 62.
.
, ,
,
() ,
.
X , (k, l) ,
; ,
X, Y Y . Y
X, (k, l), Y
X, (k, l).
Y Y w(Y) w(Y ) . ,
z0 , z0 = .
A1(C,n)
(n


, C )
1. .
2. C.
3. X=R,
w(X).
While (w(X) < z0)
begin
4. (k,l).
5. . Y
w(Y).
6. . Y
w(Y).
If ( Y = 2)
then
begin
7.
Y
If (w(Y) < z0)
then
begin
z0 = w(Y)
( )
end
end
8.
X.

12.3.

279

9. C,
X,

.
end (while w(X) < z0)
( z0 )
End.

.
, .
1. , , .

, ,
.
.
2. ,
.
3. . , .
.

.
.

.
4. ,
(k, l) Y Y,
X. (k, l) ,
Y,
Y. ,
Y ,
n .

(k, l)? C , X,

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

280

. 12.

Y = {(k, l)} .
(k, l) ckl = 0;
, , Y

w(Y ) = w(X) + min cil + min ckj .
i =k

j =l

, (k, l), ckl = 0


C , , w(Y)
.
4

Begin
( S (i, j), , [i,j] = 0
.
D[i,j] = min ( i,
c[i,j])
+ min ( j,
c[i,j])
)
D[j,j] (i,j) S
(k,l)
D[k,l] = max (D[i,j]) (i,j) S
End.

5. , Y , X.
Y :
w(Y) = w(X) + Dkl ,
Dkl 4.
6. Y, X,
X, (k, l),
4. ,
Y, ,
, , ,
.
.
Y
begin
1. k l C
X.
If ( (k,l) ,

X)
then

12.3.

281

begin
2. (p) (q)

3. C[p,q] =
end
4.
; h = .
5. w(Y) = w(X) + h
end.

7. , ,
.
, ,
Y,
. n , 2 2, (n 2)
Y, Y
.
8. X,
. .
,
,
.
.
9. X ,
, X.
,
.

.
, (. 12.6).
.
?
, , , . ,
NP- , ,
.

. ,
. .

282

. 12.

. 12.6. ,
.

(n) ,
n ,
, n .
,
n
. -
NPRH.

.
.
,
,
.
.
A2(C,n)

n , C .
Begin
1. .
2. C.
3. X=R.
w(X)
.

12.3.

283

While w(X) < z0


begin
4. (k,l).
5. . Y,
w(Y)
.
6. . Y,
w(Y)
.
If ( Y = 2)
then
begin
7.
Y
If (w(Y) < z0)
then
begin
z0 = w(Y)
( )
end
end
8.
X
9. C,
X,

end (while w(X) < z0)
( z0 )
End.

?
, ,

. ,
.

A1. ,
,
.
,

, [12.6]:
R(n) = 3,6932 e0,1819n .

(12.3.2)

, (12.3.2),
. 12.8.

284

. 12.
12.8
n

R(n)

20

140

30

866

40

5 337

50

32 909

60

202 905

70

1 251 049

80

7 713 582

90

47 559 556

100

293 237 462

, ,
,
70
730 .
,
, A2
23-
A1.

12.4. -


-

, [12.7, 12.8].
- ,
.
.
()
. 1970- ,
- ,
- .
, - ,

12.4.

285

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

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

, .

286

. 12.

, .

.
, ,
, . . .
- ,
. :
. , ,
,

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

12.4.

287

, .
,
.
,
.

- .

(, , ),
,
.

.

.
, ,
, ( ) , , , 23 %
. ,
, ,
, ,
. , , ( )

, , 14
[12.7].


, .
.
.

288

. 12.


,
.
- . ,

,
.
,
[12.8].
, ,
. ,
,
. , ,
.


.
, , ,
,
. ,
,
.

,
, . , ,
,
[12.8]. , ,
56
.

3035 %
[12.8].
-

12.4.

289


. ,

.
-
.
,

, .

( )
m ,
. ,
.
: m
, ,
.

- ,
.

. -
.
( )
.
,
.

, 36 8 . ,

. 19 . .

290

. 12.

, , , 50 % ,
. ,

.

,
.
,
,
. , , ,
, .

, ,
, ,
,
. , , ,

.
, .

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

.
: n ; k ,

12.4.

291

; a
; ta
; b

; tb
. , , ,
,
.
, k

n
, 2k

T(n, k)
,
T(n, k) = a ta k +

1
n
b tb k .
2
2

(12.4.1)

k (12.4.1),
2k+1 = n

b tb
ln 2.
a ta

2,
k, T(n, k),
k :
k = log2 n + log2

b tb
a ta

+ log2 ln 2 1.

(12.4.2)


l , :
l =

n
k

2 a ta log2 e
a ta
2,89
= 2,89 L,
b tb
b tb

(12.4.3)

L
L=

a ta
,
b tb

, .

, C++,
, 2,94 [12.8]. ,
l = 8,48 (12.4.3),

, lr 8 9 [12.8].
l ,
19*

292

. 12.

k . , k
(12.4.2), ,
, kr :
kr = [k ]

kr = [k ] + 1,

,
. ,

, kr
. , 32 56
kr = 2. (12.4.2) , ,
, , kr ,
T(n, k) k, lr 8 lr 14. . 12.7.
++, P IV (1,5 ), t
lr
.

, 45 ( [12.8]).

. 12.7. .


lr
lr 14. ,
,
2030
35 [12.8].

12.5.

293

12.5.


. [12.9],
().
, ,
().
. ,
. ,
,
.

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

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

294

. 12.

, , ,
, . , ,
[12.10]. ,
: , .

.
,
, .

,
, .
. ,

.
.
, .
,
, ,
, , .

, ,
,
.
,
[12.11]:
, ,
.
,
,
.
, , .
,
,

12.5.

295

, ,
, .
.
, ,

. ,
c .
, ,
. ,
.
, . ,


, .

:
.
, .
.
;

. , . , , [12.12]. -
.

;

.

.

.

296

. 12.

. ,
, .
:
Y = {yi },

|Y| = n,

yi = {vi , pi },

i = 1, n,

yi vi , , pi ,
, ,
.
V. , ()
; , :
n
X

vi > V.

(12.5.1)

i=1

M , V
Y,
:
X = {xi }, xi {0,1}, i = 1, n,
(12.5.2)
xi = 1
yi M Y, V.
, M,
.

yi Y \ M, :

Pn (X) =

n
X

xi pi ,

(12.5.3)

i=1

, ,
n
X
i=1

xi vi + max{(1 xi ) vi } V.

(12.5.4)

i=1,n

(12.5.4) .
, ,
,
.

297

12.5.


. (12.5.3)
,
( )
v:
V1 v V2 ,

V1 = V max{vi }, V2 = V min{vi }, i = 1, n,

,
(12.5.4).

(. 12.2),
.
(12.5.3)
N
X

xi vi V.

(12.5.5)

i=1

yj , j = 1, k, v, Xvk , fk (v)
. ,
:

f0 (v) = 0;
fk (v) = max{xk pk + fk1 (v xk vk )}, k = 1, n, v = 0, V, xk {0,1}.
xk

(12.5.5)
fn (v) Xvn v V1
V2 Y. , k = n
, . . 0 (V1 1) ,
(12.5.4).
v , (12.5.4).
( vi V) , ,
v: V1 v V2 (12.5.3), v .
d(v),
v:
d(v) = v

n
X
v

xi vi ,

i=1

xvi Xvn .

(12.5.6)

298

. 12.

d(v) , (12.5.5) v . R(v),


:
R(v) = max{(1 xvi )vi },
i

i = 1, n.

(12.5.7)


(12.5.4) v, ,
V v + d(v) R(v).

(12.5.8)

fn (v)
,
v, (12.5.8). ,
Xv
n , v
:

R(v );
V v + d(v )
V (v + 1) + d(v + 1) < R(v + 1);
(12.5.9)

V1 v V2 .
, A1 ,
(12.5.3) (12.5.5),
, (12.5.3) (12.5.4), v
(12.5.9).
A1
. , X,
yi v.
,
Xvk , O(n2 V).
R(v) d(v) O(n)
(12.5.9),
M = V2 V1 . , M < V V2 V1 ,
A1 O(n2 V).
.
O(n2 V) A1 , ( n)
,
vi V.
(V, v1 , v2 , . . . , vn ).
, . . n ,
(V, v1 , v2 , . . . , vn ) = 1, .
[12.13],

12.5.

299

, ,

6
0,607927.
2


. vi V
,
. , i = 1, n vi  V, k V
:
 
n
V
1 X
k=
, v=
vi .
v

i=1

, , m . yi
 
vi
.
v(m)
=
i
m

vi yi ,
, . , n ,
vi m .
yi
m1


.
2
k ,
V, :
v+ =

X
i : xi =1

vi k

m1
k (m 1)
=
.
2
2

(12.5.10)

m1
. , ,
2

k V
v

,
2

m+v
V + =
.
(12.5.11)
2

V V = (v+ V + ) .
m (p %)
V:
V = v+ V p V,

p=

p%
.
100

(12.5.12)

300

. 12.

(12.5.10) (12.5.11) (12.5.12), m:


1m

2pV +v+k
.
(k 1)

(12.5.13)

m. , ,
vi ,
m = min(vi ).
i=1,n

A1 ,

m .
.
[12.5]
. ,

(. [12.5]).
. (12.5.4)
. , k
:
V

k1
X
j=1


vj + vk max {vi },
k+1in

(12.5.14)

i = 1, n

pi
.
vi

(12.5.14) ,
k + 1, ( 1,2, . . . , k)
V .
(12.5.14)  M.


.
.
,
, (12.5.14) -

12.5.

301

.
Mk (v):

M0 (v) = max {vi };

1in

Mk1 (v),
(12.5.15)
vk < Mk1 (v);

M
(v)
=
k

max {vi }, vk = Mk1 (v).


k+1in

V (k) =

k
X

vj . (12.5.14)

j=1

V V (k 1) + vk Mk (v),
V V (k) + vk+1 < Mk+1 (v).

(12.5.16)

, A2
. pi

. vi
,
vk
(12.5.16), Mk (v)
(12.5.15).
A2 .
n
, ,
O(n ln n) [12.5]. X
k ; , (12.5.16)
k , k n
. , ,
O(n ln n) .
(12.5.16) O(1).
M0 (v), , O(n).
n vi
O(ln n) [12.14], . . .
, Mk (v) ,
k < N, O(ln n) , Mk (v) O(1).
Mk (v)
(12.5.16) O(n) .
,
:
O(n) + n O(1) + O(ln n) O(n) = O(n ln n).
, A2 O(n ln n), , A1, A2 ,

302

. 12.

. ,

.
. ,



. , ,

.
, .

,
, .



.
,

.
,
, ,
.


12.1.
.
(k = 12),
?
12.2. .
,
.
12.3.
. (12.2.5)?

303

12.4.
, .


12.1. . ., . . . .: , 2006. 296 .
12.2. ., . : . . .: , 1965. 457 .
12.3. . ., . ., . C., . .
// Exponenta Pro. . 2004. 2 (6). . 6470.
12.4. Little J. D. C., Murty K. G., Sweeney D. W., Karel C. An algorithm for the
traveling salesman problem // Operat. Res., 11 (1963), pp. 972989.
12.5. ., . :
. . .: , 1981. 368 .
12.6. . ., . . //
:
. . 9. / . . . .: , 2006. . 7682.
12.7. . ., . . // . 2004.
9. . 1824.
12.8. . ., . ., . . // . 2004.
10. . 3236.
12.9. . ., . .
// . 2004. 12.
. 1722.
12.10. Inmon W. H. Building the data warehouse: Third edition. New York: John
Wiley and Sons, 2002. 412 p.
12.11. Deshpande P. M., Ramasamy K., Shukla A., Naughton J. F. Caching multidimensional queries using chunks // Proceedings of ACM SIGMOD, June
1998, pp. 259270.
12.12. . . : .
. 9- ., . .: . ., 2003. 479 .
12.13. ., . : . . .:
, 1999. 720 .
12.14. ., ., . : :
. . .: , 1999. 960 .