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

. .

1000

III
,
, ,

-,

--
2004



-
14 2004 . ( 10)

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


, ,
, , .
,
, ,
Pascal, C++, Basic.
-, .
: . . .

. . , 2004

17 : Text
,
( ).
.
,
(, ,
).
,
, ,
.
, () .

17.1
Text1. N K. N , K * ().
Text2. N (0 < N < 27).
N : ( ) a,
ab, abc . .; N .
Text3. N (0 < N < 27).
N N; K
(K = 1, , N) K ( ) , * (). , N = 4 A***, AB**,
ABC*, ABCD.
Text4. . ( EOLN EOF
).
Text5. S . S .
Text6. .
.
Text7. S . S .
Text8. . .

Text9. K .
K. ,
.
Text10. K .
K. ,
.
Text11. . .
Text12. S .
S.
Text13. . .
Text14. . .
Text15. K . K. , .
Text16. . .
Text17. .
.
, .
Text18. K . K ( K,
).
Text19. .
, .
Text20. .
.
Text21. , .
.
Text22. K (0 < K < 10) ,
K . K .
Text23. K (0 < K < 10) ,
K . , K
.

17.2
Text24. . ,
.
Text25. K . K (
). ,

, . , .
Text26. . ,
5 ( ). .
Text27. K . K ( .
Text26). .
, .
Text28. .
(. Text26), . ( ).
Text29. . .
,
/ .
Text30. .
. , / .
Text31. K . K .
, ,
, / . K,
.
Text32. C ()
.
, ( ).
, ,
, / . , .
Text33. C ()
.
, C ( ). , ,
, /
. ,
.

Text34. , , .
,
( 50).
Text35. , , .
,
( 50).
.
Text36. , ,
. , . .
Text37. , , .
.
( , ), ( ) , (
50).
Text38. K (> 25) , , . . ,
K , , . . .
Text39. K (> 25) , , .
(5 ), .
, K ,
, .
. .

17.3
, ,
, ( ,
).
Text40. .
, , 30
( , ). -

| ( 124).
.
Text41. .
, ,
20 (
). | ( 124).
.
Text42. A, B N.
, x [A, B]
(B A)/N. : x
(10 , 4 ) x (15 , 8 ).
.
Text43. A, B N.
, sin(x) cos(x) [A, B] (B A)/N. : x (8 , 4 ) sin(x)
cos(x) ( 12 , 8 ). .
Text44. , ,
.
.
Text45. ,
,
( ). .
Text46. ,
, (
). , ( ) , .
Text47. ,
,
( ). .
Text48. ,
, (
). ,
( ).

Text49. .

. , .
Text50. . 30
, .
: , ,
, (
).
Text51. , . , - . , ( ).
Text52. , . , -. , - .
, .

17.4

Text53. . ,
, ( ).
Text54. . , , , (
). .
Text55. . , , , (
). .
Text56. . , , , (
). .
Text57. .
( ) ,
<>< > (, 25). , , .
.

Text58. .
( ) ,
<>< > (, 25). , , .
, .
Text59. S, 10 , . , ,
K- , , SK- ( K = 11
S1 . .). , .
Text60. , ,
Text59.
. . , .

18


: Param


.
.
, ( ); ,
.

18.1
(
,
-), .
, , , 1 10. -
, 1
10. , 1.
, , .

10

Param1. MinInt(A, N) , A N. A, B, C NA, NB, NC .


Param2. NMax(A, N) , A N.
A, B, C
NA, NB, NC .
Param3. NMinmax(A, N, NMin, NMax),
A N. : NMin ( ) NMax ( ). A,
B, C NA, NB, NC .
Param4. Invert(A, N), A N ( ). A .
A, B, C NA,
NB, NC .
Param5. Smooth1(A, N), A N : AK K A.
A .
A N, .
Param6. Smooth2(A, N), A N : A1 , AK (K = 2, , N) AK1 AK. A .

A N, .
Param7. Smooth3(A, N), A N :
( ). A . A N, .
Param8. RemoveX(A, N, X),
A N , X. A

11

N . XA, XB, XC A, B, C NA, NB, NC .


Param9. RemoveForInc(A, N), A N , :
, , ,
, , . .
, 5.5, 2.5, 4.6, 7.2, 5.8, 9.4 5.5, 7.2, 9.4. A N . A, B, C
NA, NB, NC .
Param10. DoubleX(A, N, X), A N , X. A
N .
XA, XB, XC A, B, C NA,
NB, NC .
Param11. Sort(A, N), A N. A
. A, B, C NA, NB, NC .
Param12. SortIndex(A, N, I), A N I
, A , A ( A
). I .
A,
B, C NA, NB, NC .
Param13. Bell(A, N), A N : ,
, ,
. . (
). A .
A, B, C NA, NB, NC .
Param14. Split1(A, NA, B, NB, C, NC), A NA B C NB NC ; B

12

A (1, 3, ), C
A (2, 4, ). B C
NB NC .
A NA B C.
Param15. Split2(A, NA, B, NB, C, NC), A NA B C
NB NC ; B
A, C ( ).
B C NB NC . A NA
B C.
Param16. ArrayToMatrix1(A, K, M, N, B),
A K B M N (
A ). ; ,
0. B
.
A K M N B M N.
Param17. ArrayToMatrix2(A, K, M, N, B),
A K B M N (
A ). ; ,
0. B
.
A K M N B M N.
Param18. Chessboard(M, N, A),
M N A M N,
0 1, , A1,1 = 0. A . M N
A M N.
Param19. Norm1(A, M, N) , A M N:
Norm1(A, M, N) = max {|A1,J| + |A2,J| + + |AM,J|},
J 1 N. A
M N Norm1(A, K, N), K = 1, , M.

13

Param20. Norm2(A, M, N) , A M N:
Norm2(A, M, N) = max {|AI,1| + |AI,2| + + |AI,N|},
I 1 M. A
M N Norm2(A, K, N), K = 1, , M.
Param21. SumRow(A, M, N, K) , A M N, K- ( K > M, 0).
A M N K SumRow(A, M, N, K).
Param22. SumCol(A, M, N, K) , A M N, K- ( K > N, 0). A M N K SumCol(A, M, N, K).
Param23. SwapRow(A, M, N, K1, K2), A M N
K1 K2. A ; K1
K2 M, . , A M N
K1 K2.
Param24. SwapCol(A, M, N, K1, K2), A M N K1 K2. A ;
K1 K2 N, . ,
A M N K1 K2.
Param25. Transp(A, M),
( ) A M. A
. , A M.
Param26. RemoveRows(A, M, N, K1, K2), A M N K1 K2
(, 1 < K1 K2). K1 > M,
; K2 > M,
K1 M. A M, N . RemoveRows,
A M N K1 K2
.
Param27. RemoveCols(A, M, N, K1, K2), A M N K1 K2

14

(, 1 < K1 K2). K1 > N,


; K2 > N,
K1 N. A M, N . RemoveCols,
A M N K1 K2 .
Param28. RemoveRowCol(A, M, N, K, L),
A M N , AK,L (, M > 1 N > 1; K > M L > N,
). A M, N
. A M N
K, L. A RemoveRowCol
.
Param29. SortCols(A, M, N),
A M N (
: , , ;
, . .). A . SortCols,
A M N.

18.2
Param30. IsIdent(S) , ,
S , , , _
. S ,
0. S ,
1, S , 2. S , . IsIdent .
Param31. FillStr(S, N) ,
N, - S ( - ). ,
N -
N.
Param32. UpCaseRus(S),
S ( S ). S . UpCaseRus, .

15

Param33. LowCaseRus(S),
S ( S ). S .
LowCaseRus, .
Param34. TrimLeftC(S, C), S , C. S
. C .
TrimLeftC, .
Param35. TrimRightC(S, C), S , C. S
. C .
TrimRightC, .
Param36. InvertStr(S, K, N) ,
S, N
S, K- . K
S, ; K + N,
, K- .
InvertStr S : (K1, N1), (K2, N2), (K3, N3).
Param37. PosSub(S0, S, K, N) ,
, S S0, N S,
K- ( , PosSub ). K S, 0,
K + N, ,
K- . S S0 , 0. PosSub
S0, S :
(K1, N1), (K2, N2), (K3, N3).
Param38. PosLast(S0, S) ,
, S
S0. , S0
S . S S0, 0.
S0 S.
Param39. PosK(S0, S, K) ,
, S K- S0 (K > 0). S0 S K,
0. , S0 S .
: S0, S K.

16

Param40. WordK(S, K) , K-
S ( , / ). K, . , S K1, K2, K3.
Param41. SplitStr(S, W, N),
S W , S ( W N
). , / ;
, S 10 . SplitStr, N, S,
.
Param42. CompressStr(S) ,
S : S, C,
{K}, K C (,
S { }). ,
S = bbbccccce bbbc{5}e.
CompressStr .
Param43. DecompressStr(S) , , CompressStr (. Param42).
S ;
. DecompressStr
.
Param44. DecToBin(N) ,
N
. 01
( 0).
,
.
Param45. DecToHex(N) ,
N 16-
. 09,
AF (
0). , 16-
.
Param46. BinToDec(S) ,
S
. S ,
01 ( 0).

17

, , .
Param47. HexToDec(S) ,
S 16-
. S ,
09, AF ( 0). , ,
16- .

18.3
Param48. IntFileSize(S) , S. , 1.
.
Param49. LineCount(S) , S. ,
1.
.
Param50. InvertIntFile(S),
S .
, .
.
Param51. AddLineNumbers(S, N, K, L), S : N, N + 1 . .
K , L (K > 0, L > 0).
, ,
. ,
N, K L.
Param52. RemoveLineNumbers(S),
S , AddLineNumbers (.
Param51), , .
,
. .
Param53. SplitIntFile(S0, K, S1, S2), K
( 0) S0
S1, -

18

S2. .
S0, K, S1 S2.
Param54. SplitText(S0, K, S1, S2), K
( 0) S0 S1, a
S2. . S0,
K, S1 S2.
Param55. StringFileToText(S),
S .
, S1
S2 .
Param56. TextToStringFile(S),
S .
, S1
S2 .
Param57. EncodeText(S, K),
S,
, K-
(0 < K < 10). , K = 3 ,
. , ,
. , , . K,
.
Param58. DecodeText(S, K),
S, K
( Param57).
K, .

18.4
Param59Param63
, , . Param64Param70 (x-), (y-).
Param59. TDate Day (), Month
() Year () LeapYear(D) TDate, True, D
, False .
LeapYear (,

19

). , 4, , 100 400.
Param60. TDate LeapYear (. Param59),
DaysInMonth(D) TDate,
, D. DaysInMonth (, ).
Param61. TDate DaysInMonth (. Param59
Param60), CheckDate(D)
TDate, , D.
D , 0;
, 1; , 2. CheckDate .
Param62. TDate DaysInMonth CheckDate (. Param59Param61), PrevDate(D)
TDate, D ( D , ). D
. PrevDate .
Param63. TDate DaysInMonth CheckDate (. Param59Param61), NextDate(D)
TDate, D ( D
, ). D . NextDate .
Param64. TPoint X Y
( ) Leng(A, B)
, AB :

. B.Y ) 2
|AB| = ( A. X B. X )2 + ( AY
(A B TPoint).
AB, AC, AD, A, B, C, D.
Param65. TPoint Leng (. Param64), TTriangle A, B, C TPoint ( ) Perim(T) , T (T TTriangle).
ABC, ABD, ACD, A, B, C, D.
Param66. TPoint, TTriangle Leng Perim (. Param64 Param65), Area(T) ,

20

T (T TTriangle)
:
SABC = p ( p AB ) ( p AC ) ( p BC ),
p . ABC, ABD, ACD, A, B, C, D.
Param67. TPoint, TTriangle Leng Area (. Param64Param66), Dist(P, A, B)
(P, A, B TPoint), D(P, AB)
P AB
D(P, AB) = 2SPAB/|AB|,
SPAB PAB.
P AB, AC, BC,
P, A, B, C.
Param68. TPoint, TTriangle Dist (.
Param64, Param65, Param67), Heights(T, h1, h2, h3), h1, h2, h3 T (T
TTriangle, h1, h2, h3 ),
T.A, T.B, T.C.
ABC, ABD, ACD, A, B,
C, D.
Param69. TPoint Leng (. Param64), PerimN(P, N) , N, ( ) P N (> 2) TPoint.
, .
Param70. TPoint, TTriangle Area (.
Param64Param66), AreaN(P, N) , N-, (
) P N (> 2)
TPoint. ,
.

19

: Recur

19.1
.
, , . ,

21

(., ,
Recur4 Recur6).
.
Recur1. Fact(N) ,
N! = 12N
(N > 0 ).
.
Recur2. Fact2(N) ,
N!! = N(N2)(N4)
(N > 0 ;
2, N , 1, N ).
.
Recur3. PowerN(X, N) , N- X :
X 0 = 1,
X N = (X N / 2)2 N > 0,
X N = XX N1 N > 0,
X N = 1/X N N < 0
(X 0 , N ; N
). X N X N.
Recur4. Fib1(N) ,
N- (N ):
F1 = F2 = 1,
FK = FK2 + FK1, K = 3, 4, .
,
Fib1, .
Recur5. Fib2(N) ,
N- (N ):
F1 = F2 = 1,
FK = FK2 + FK1, K = 3, 4, .
, N 20. Fib1 (. Recur4)

Fib2. Fib2 .
Recur6. Combin1(N, K) , C(N, K) N K :

22

C(N, 0) = C(N, N) = 1,
C(N, K) = C(N 1, K) + C(N 1, K 1) 0 < K < N.
; N > 0, 0 K N. N
K. C(N, K) Combin1, .
Recur7. Combin2(N, K) , C(N, K) N K :
C(N, 0) = C(N, N) = 1,
C(N, K) = C(N 1, K) + C(N 1, K 1) 0 < K < N.
; N > 0, 0 K N. , N 20. Combin1 (. Recur6)
C(N, K) Combin2. Combin2 C(N, K) N
K.
Recur8. RootK(X, K, N) ,
K- X :
Y0 = 1,
YN+1 = YN (YN X/(YN)K1)/K,
YN RootK(X, K, N) X K.
: X (> 0) , K (> 1) N (> 0) . RootK X K- N.
Recur9. NOD(A, B) ,
() A B, :
(A, B) = (B, A mod B), B 0;
(A, 0) = A.
(A, B), (A, C), (A, D),
A, B, C, D.
Recur10. DigitSum(K) , K, . .
Recur11. MaxInt(A, N) ,
A N
(1 N 10), .
A, B, C NA, NB, NC .

23

Recur12. DigitCount(S) ,
S, .
.
Recur13. Palindrom(S) , True, S (
), False .
. Palindrom .

19.2
, ,
, . .
Recur14. ,
S. :
<> ::= <> | <> + <> |
<> <>
Recur15. ,
S. :
<> ::= <> | <> + <> |
<> <>
::= <> | <> * <>
<>
Recur16. ,
S. :
<> ::= <> | <> + <> |
<> <>
::= <> | <> * <>
<>
::= <> | (<>)
<>
Recur17. , S. :
<> ::= <> |
(<><><>)
::= + | | *
<>
Recur18. ,
S ( ,
Recur17). , True,
False.

24

Recur19. , S ( ,
Recur17). , 0, ( )
S.
Recur20. ,
S. ( M , m ):
<> ::= <> | M(<> , <>) |
m(<> , <>)
Recur21. , S.
(T True, F False):
<> ::= T | F | And(<> , <>) |
Or(<> , <>)
Recur22. ,
S. ( M , m ):
<> ::= <> | M(<>) | m(<>)
<> ::= <> | <> , <>
Recur23. , S.
(T True, F False):
<> ::= T | F | And(<>) | Or(<>)
<> ::= <> | <> , <>
Recur24. , S.
(T True, F False):
<> ::= T | F | And(<>) |
Or(<>) | Not(<>)
<> ::= <> | <> , <>

19.3
Recur25. N,
K (< 10) ( 1 K). 0. , . ,
( ).

25

Recur26. N,
K (< 10) ( 1 K). 0. ,
:
.
, Recur25.
Recur27. N (N ),
2 : A 1 B 1.
C 0.
, :
0. ,
Recur25.
Recur28. N , Recur27. ,
:
.
, Recur25.
Recur29. N,
3 : A 1, B 0 C 1. D 0.
, :
, 0.
, Recur25.
Recur30. N , Recur29. ,
:
,
0. , Recur25.

20 :
Pointer
, , .
PNode TNode.
Pascal PNode TNode :
type
PNode =
TNode =
Data:
Next:

^TNode;
record
Integer;
PNode;

26

Prev: PNode;
end;

C++:
struct TNode
{
int Data;
TNode* Next;
TNode* Prev;
};
typedef TNode* PNode;
(Pointer1Pointer28)
TNode Data Next (. Pointer1); (Pointer29Pointer80) TNode (. Pointer29).
, ( )
( ) . nil
Pascal. C++
0 NULL.

20.1
Pointer1. P1 TNode, Data ( )
Next ( PNode TNode).
Next . Data
, P2 .
Pointer2. P1 TNode. Next
, , , ,
, Next nil ( ,
). Data , ( ) .
Pointer3Pointer13 (stack) - TNode (. Pointer2). Next
nil. (top)
.
( nil). Data.
Pointer3. D P1 .
D P2 .

27

Pointer4. N (> 0) N . , ( ), .
Pointer5. P1 . () D, P2
. ,
P2 = nil. ,
.
Pointer6. P1 ,
. . . , .
Pointer7. P1 ( , P1 = nil). . N ( 0). , .
Pointer8. P1 P2 . ( , ) . .
Pointer9. P1 P2 . , (
, ).
, .
( ,
nil). .
Pointer10. P1 .
, , ( , ;
). (
nil).
.
Pointer11. P1 ( , P1 = nil).
N (> 0) N . TStack
Top PNode ( )
Push(S, D), S -

28

D (S TStack, D ). Push
( ) .
Pointer12. P1 , . TStack (. Pointer11),
Pop(S) , S () , , (S TStack).
Pop . (
, nil).
Pointer13. P1 . TStack (. Pointer11), StackIsEmpty(S) ( True, S , False ) Peek(S) ( S,
). S TStack. , Pop
Pointer12, ( , ) . StackIsEmpty ,
,
.

20.2
Pointer14Pointer28 (queue)
- TNode (. Pointer2).
Next nil. (,
head) , (, tail) .
, , . nil. ,
Data.
Pointer14. 10 . ,
( ,
), P1 P2 .
Pointer15. 10 . : (1, 3, , 9), -

29

(2, 4, , 10);
. , .
Pointer16. 10 . : , ( ). , ( ; nil).
Pointer17. D P1 P2 (
, P1 = P2 = nil).
D .
Pointer18. D P1 P2 , . D
() . . ,
.
Pointer19. N (> 0) P1 P2
. N ( N , ). ( nil). , .
Pointer20. P1 P2 . ,
, (
, ). ( nil). , .
Pointer21. ; P1 P2,
P3 P4 ( , nil). (
)
. .
Pointer22. N (> 0) ;
P1 P2, P3 P4. N . N ,

30

. , ( nil). .
Pointer23. ; P1
P2, P3 P4.
, ( , ). , (
nil). .
Pointer24. ; P1
P2, P3 P4. . , ( ).
.
.
Pointer25. ; P1
P2, P3 P4.
( ). .
. , Data .
Pointer26. P1 P2 ( , P1 = P2 = nil). N (> 0) N . TQueue PNode: Head ( ) Tail ( ) Enqueue(Q, D), Q D (Q
TQueue, D
). Enqueue .
Pointer27. P1 P2 ,
. TQueue (. Pointer26), Dequeue(Q) , () , ,
(Q
TQueue). Dequeue
.
( ,
nil).

31

Pointer28. P1 P2 .
TQueue (. Pointer26), QueueIsEmpty(Q) , True, Q , False
(Q TQueue).
, Dequeue
Pointer27,
( , )
. QueueIsEmpty
.

20.3
Pointer29. P2 TNode, Data ( ) Prev Next ( PNode TNode). Prev Next . Data , P1 P3 .
Pointer30. P1 -
TNode, Next. Prev TNode, ()
,
( Next), (
Prev). Prev nil.
.
Pointer31Pointer69 (doubly
linked list) - TNode,
, (. Pointer30). Next
Prev nil.
,
: (first),
(last) (current). nil. ,
Data.
Pointer31. P0 . N ,
P1 P2 .
Pointer32. D1 D2 P0
. D1, D2. .

32

Pointer33. D P0 .
D .
Pointer34. D P0 .
D .
Pointer35. P1 P2 , . ( )
.
Pointer36. P1 P2 , . ( ) .
Pointer37. P1 .
(
) .
Pointer38. P1 .
(
) .
Pointer39. P1 .
(
) .
Pointer40. P1 .
(
) .
Pointer41. P0 . : , , , ( ;

33

nil).
, .
Pointer42. P1 , .
. ,
.
Pointer43. P1 .
( , nil).
, .
Pointer44. P0 .
. , Data .
Pointer45. P0 .
. , Data .
Pointer46. K (> 0) P0
. K
( K , ).
.
, Data .
Pointer47. K (> 0) P0
. K
( K , ).
.
, Data .
Pointer48. PX PY ( PX
PY, ).
.
, Data .
Pointer49. P1 .
,
( ) -

34

. , Data .
Pointer50. P1 .
,
( ) . , Data .
Pointer51. : PA PB , PC
. ,
( )
,
.
.
Pointer52. : PA PB , PC
. ,
( )
,
.
.
Pointer53. PX PY ; PX
PY, . ,
( ) (
). . ,
nil.
.
Pointer54. PX PY ; PX
PY, . ,
( ) ( ). . , nil. .
Pointer55. P1 .
, Next , Prev

35

, , .
Pointer56. P1 P2
, . (. Pointer55),
,
. PA PB
( PA , PB ).
.
Pointer57. K (> 0) P1 P2 . K (
) . (. Pointer55), , K.
.
Pointer58. K (> 0) P1 P2 . K ( ) . (. Pointer55),
, K. .
Pointer59. P1, P2 P3 , ( , P1 = P2 = P3 = nil).
N (> 0) N . TList
First, Last Current PNode (
, )
InsertLast(L, D), D
L (L TList, D ). .
( ) ,
.
Pointer60. P1, P2 P3 , ( , P1 = P2 = P3 = nil).
N (> 0) N . TList (. Pointer59), InsertFirst(L, D),

36

D L (L TList, D ). .
(
)
, .
Pointer61. , ,
P1, P2 P3. . TList (. Pointer59),
InsertBefore(L, D), D
L (L
TList, D ). .
, .
Pointer62. , ,
P1, P2 P3. . TList (. Pointer59), InsertAfter(L,
D), D L (L TList, D ). .

, .
Pointer63. , ,
P1, P2 P3. TList (. Pointer59), ToFirst(L) (
L), ToNext(L) ( L , ), SetData(L, D) (
L D ) IsLast(L)
( True, L
, False ). L TList;
ToFirst ToNext .
, .
Pointer64. , ,
P1, P2 P3. TList (. Pointer59), ToLast(L) (
L), ToPrev(L) ( L
, ) GetData(L) ( L), IsFirst(L)

37

( True, L
, False ). L TList;
ToLast ToPrev .
, . .
Pointer65. P1, P2 P3 , , .
TList (. Pointer59), DeleteCurrent(L)
, L (L TList).
,
, . , .
. , .
Pointer66. P1, P2 P3 , . TList (.
Pointer59), SplitList(L1, L2),
L1 L2 ( ,
L1 , ). TList;
, . .
.
, .
Pointer67. , . TList (. Pointer59),
AddList(L1, L2), L2 ( ) L1; L2 . L1 . TList
.
.
, .
Pointer68. , . TList (. Pointer59),
InsertList(L1, L2),

38

L2 ( ) L1 ;
L2 . L1
.
TList .
.
, .
Pointer69. ,
( ).
TList (. Pointer59), MoveCurrent(L1, L2), L1 L2 ( L2 ; L1 ,
, ).
TList .
.
, .
Pointer31Pointer69
, ,
. , , . Next Prev
, , , , (,
Prev Next ).
, , : Barrier, ,
Current, ( , ). Data
; 0. ,
; , Next Prev
, Barrier.
Pointer70Pointer80
.

39

Pointer70. P1 P2 , ,
( , P1 = P2 = nil).
(. Pointer55), . 0
Next Prev
( Next Prev
). . .
Pointer71. P1 P2 ( . Pointer70). ,
. , (
). .
.
Pointer72. P1 P2
( . Pointer70). ,
(
). ( , ). .
Pointer73. P1 P2
( . Pointer70). ,
(
). ( , ). .
Pointer74. P1 P2 ( . Pointer70). N (> 0) N . TListB
Barrier Current PNode (
) LBInsertLast(L, D),
D L (L

40

TListB, D
). . (
) .
Pointer75. P1 P2 . N (> 0) N .
TListB (. Pointer74), LBInsertFirst(L, D), D L (L
TListB, D
). . ( )
.
Pointer76. P1 P2 . . TListB (.
Pointer74), LBInsertBefore(L, D), D L (L
TListB, D
). . .
Pointer77. P1 P2 . . TListB (.
Pointer74), LBInsertAfter(L, D),
D L (L
TListB, D ).
.

.
Pointer78. P1 P2 . TListB (. Pointer74), LBToFirst(L) ( L),
LBToNext(L) ( L ),
LBSetData(L, D) ( L D , )
IsBarrier(L) ( True, L , False ). L TListB; LBToFirst LBToNext .

,

41

. .
Pointer79. P1 P2 . TListB (. Pointer74), LBToLast(L) ( L),
LBToPrev(L) ( L )
LBGetData(L) (
L). L TListB; LBToLast LBToPrev
. ,
IsBarrier Pointer78,
,
. .
.
Pointer80. P1 P2
, .
TListB (. Pointer74),
LBDeleteCurrent(L) , L
(L
TListB). ,
, .
, .
,
0. ,
IsBarrier Pointer78,
( , ) .
.

42

1. . ., . .
- .
2. --: , 1993. 31 .
2. . . : PASCAL 7.0.
. .: , 1997. 256 .
3. . ., . ., . . 100 .
.: , 1993. 255 .
4. / . . , . . , . . , . . . .: , 1988. 224 .
5. . . : . 711 : . .: -
, 2001. 208 .
6. . ., . .
. .: , 1986. 272 .
7. . . . .: ,
1989. 160 .
8. / . . , . . ,
. . , . . . .: , 1998. 384 .
9. : / . . . .
.: , 2002. 336 .
10. . . . .: , 2002.
192 .
11. . ., . .
: , ,
. --: - , 2004. 198 .
12. . . . 4- .
--: - , 2004. 187 .

43

17. : Text............................................................................. 3
17.1. ..........................................................3
17.2. ...........................................................................4
17.3. ..........................................................6
17.4. ..................................8

18. : Param................. 9
18.1. ........................................................................9
18.2. ......................................................................................................................14
18.3. .......................................................................................................................17
18.4. .......................................................................................................................18

19. : Recur....................................................................................... 20
19.1. ..................................................................20
19.2. ...................................................................................................23
19.3. ...............................................................................................24

20. : Pointer...................... 25
20.1. ........................................................................................................................26
20.2. ....................................................................................................................28
20.3. .................................................................................................31

................................................................................................................. 42

Оценить