You are on page 1of 28

BITS, BYTES WORDS.

, , '
.
, 0 1 ( 0 , 1
). (.. , ,
).
bit: H (Binary digIT)
0 1
0 :
1 :
bits
Byte 8 bits.
T word (), () bits
, . '
,
. word . ,
32-bit word 32 bit,
16-bit word 16 bit
8-bit word 8 bit
word
( '
- )

H .
words
:
() (CPU instructions)
()
() ()

, .
.
1 word.
, o bits (format)
.
.
words.
.
.
8-bits . 8-bits '
256 , 2 (
).
2 bits 4 :
0 0,
1 0,
0 1,
1 1
3 bits 8 :
0, 0, 0
0, 0, 1
0, 1, 0
0, 1, 1
1, 0, 0
1, 0, 1
1, 1, 0
1, 1, 1
n

n bits 2
8 bits 256 . .
:
1

01000001,
a
0110001,
01000010,
b
0110010,
C 01000011,
c
0110011,
(ISO, ASCII)

. -928
( ).
928 .



(, /).
( 10).
10- 2- .
8- 16- 10 2- ( 8- 16- ,
2- ).

1.

2-

8-

10-

0
1
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111
10000

0
1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
20

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

16-
0
1
2
3
4
5
6
7
8
9

C
D
E
F
10

T 2 0 1.
(. 10) 2.
8 0,1,2,3,4,5,6,7.
H (10) 8.
10- , 0,1,2,3,4,5,6,7,8,9
( 10).
16- 16 0,1,2,3,4,5,6,7,8,9, ,
, C, D, E F.
H (. 10) 16.

10-, :
k- :
X1X2X3...X (k) , k
10- :

1*k(-1) + 2*k(-2) + 3*k(-3) + . . . + (-1)*k1 + X*k0


. 16- 3C1 10-:
3*163 + 10*162 + 12*161 + 1*160 = 15041
101100 10-:

1*25 + 0*24 + 1*23 + 1*22 + 0*21 +0*20 = 44


2. 16- 2-
16-
. 16-
2-.
. 16- 45D :
16- 4 = 0100 2-
= 1010 "
5 = 0101 "

D = 1101 " .
2


0100101001011101
16- :
2- 10010000111010111.

1 0010 0001 1101 0111.
16-
2-
16-
1 => 1
0010 => 2
0001 => 1
1 101 => D
01 1 1 => 7
16- 121D7
3. 8- 2-

.
. 8- 64752 , ,
8- 2-
6 => 110
4 => 100
7 => 111
5 => 101
2 => 010
: 110100111101010
' 8-
,
110 100 111 101 010
8- 64752.
4. 10- 2-.
2 0.
2- . .
73,
78 : 2 = 39 0
19 : 2 = 9
>>
1
9:2=4
>>
1
4:2=2
>>
0
2:2=1
>>
0
1:2=0
>>
1
: 1001110
5. .
. .
,


0+0=0
0+0 = 0
1+0=1
1+0 = 1
0+1=1
0+0 = 1
1+1=2
1 + 1 = 1 0 ( 2 !)
.
2+1=3
10 + 1 = 11
3+1=4
11 + 1 = 100
69
+ 15
-----84

1000101
+
1111
--------------1010100

928 (ISO 8859)


Bits

b8b7b6b5 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001

b4b3b2b1

HEX

0000

SP

0001

0010

"

0011

0100

0101

0110

1010

1011 1100 1101 1110 1111

NBSP

&

0111

'

1000

1001

1010

1011

1100

<

1101

SHY

1110

>

1111

DEL


/ .
,
( )
, - () (machine
language).
,
( - executable).

( ).
,
,
(
). (,
), ,
().
/ ,
.
.
:
,

, (
).
( ),
.
(: , ,
- - ).
.
(object oriented) ,
, () ,
.
, (knowledge
base)
.
(inference engine) .

/ (compilers)
compilers
() , .
compilers ( )

(linkers).

FORTRAN compiler FORTRAN
FORTRAN
( )
. :
1. ()
2. compiler
3.

Compiler

compilers interpreters, o
.
compiler
.


(machine language)
.
. ,
(CPUs) .
(
),
. (
) .

assembly ()
.

. assembly .
, System Software,
' hardware.

O Assembler (;)
assembler assembly .
(object code) (load)
, (.. ) .
assembler
(CPU) . CPU.
(IBM-compatible) '86
(8086, 80286, 80386, 80486) INTEL 68000
TOROLA assembler. assembler cross-assembler.
O emulator assembler . ( ;)
A
. 80486 INTEL
cross-assembler M68000 OTOROLA
emulator "" ( 80486).

, 68000 .
68000 .


FORTRAN (FOrmula TRANslator)
(1957)
,

.
.

COBOL (COmmon Business Oriented Language)


50,
.
'
, .
, ,
COBOL.

PASCAL
, ,
.
. ""
, .
compilers
. (urbo Pascal).

SIC (Begginner's All-purpose Symbolic Instruction Code)


,
.
, .
.
interpreter.
. .
(Visual Basic) .

C

. C UNIX
, hardware. To
System Software C. ,

, . C++
, , C.

LISP (LISt Programming)


(1958)
.
5 .
(Artificial Intelligence).

H PROLOG
LISP. ,
.
. (Ada, dula,
Algol, PL/1, Logo, Snobol, APL, Smalltalk , HTML JAVA , 100)
, ' .
.


4 80,

(Data Bases),
(DBMS - Data Base Management Systems)
. (
, ) MS-Windows,

client-server ( 90), 4
.

. , 4 5 ,

.
5
.
( ).


.
" "

(software), , ,
(system software). "
";
,
, "
". "" ( )
; ! , , ,
.
, , , ,
.
, ,
.

.
;
,
.

.
,
;
,
. ,
.
.

,
.
(. )
(. ).
(projects) ' ,
, ,
, .

.

(hardware). o ,
.
(software) , .


:
()
()
()
()
()
- () .
,

.

O .

, ( '
). - :

()


(Royce 1970)
.
-.
,
(feedback) (). (
) .
' () ,
(Waterfall
model) .

. (prototyping)
, ,
( 4 - 4GL),
. ,
, .
, , ,
.
,
,
.
.
. :


.
(),
,
, .
. ,
hardware ,
(software)
.
.
O .
.

.
( ).
/ .
,
( ) .
.

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

. , ,
.
.

(). ,
hardware (, ) .
( )
(). ' , ,
.

/
,
. ,
(, , , ) ,
.
,
,
.
"" (software developers)
. ,


(Requirement Analysis).
.
(System Specification) , ,
(-) .
, ,
.


( ).
oar ( 1984) , 50-80%
, "" (). James Martin
(1982) 80%
.
:
10

,
.
( ).
: !

.
.
( )
(
).
.
(. ) "" (gap
analysis).
""
.

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

.
,
, .
(document) (
) .
(document)
( !). ,
( , )
.
( )
, ,
, .

()
.
, (inputs)
(outputs), ,

.

(software) ,
, , ,
11

-.

.

. (
). (
).
:
;
;
;

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

...
.


.
, ' '
.
Heniger (1980)
:

( ,
)
,
,
,
-
.

. (
).

. '
. .
Sommerville "Software Engineering" (1985)
:
1. ,
, .
.
2. .
.
.
3. hardware ,
, (. barcode readers)
.
4. .
.
12

5. .
.
6. .
.
7. .

.
8. .
9. .

(;)
,

(prototyping method).
4 (Geoff Simons, Introducing Software
Engineering, 1987):
1.
2.
3.
4.

.

,
.

.
.
( 4 ,
),
.

. .
.

(, , ).
.
:
,
.
,

13


( )
( )
,
.

O
,
.
, ,
,
.

( , , , .).
"" ,
.
:
" , ,
, " (Taylor, 1959)
" ,
" (Teague & Pidgeon, 1985)
' "
".
,
.
( ).

. Pressman (1982)
:



,
.

. .
,
( ) .

" " .

.
' .
.

.
.
()
() () ().
14

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

.
.

,
.



. ,

.
(machine language) -
( / processor) .
( -assembly)
. (
) .
C, FORTRAN, PASCAL
, ,
compilers ()
interpreters (;). compilers / interpreters
() (compilation)
(CPU
processor) ( -executable).
()
,
( Windows, Unix ) .

:

(structured programming)

(object oriented programming)


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

4.1
1965 E.W. Dijkstra IFIP GOTO
. Bhm & Jacopini 1966
:
,
:

1. , ()
, .

2. , if ... Then ... else,


.

3. , while ... do repeat ... until.

15

,
( GOTO)
!

"" ,
!
()
.
:
()
() ()
() .
,
"" ""
.
A ( projects, )
GOTO,
projects , ,

.
GOTO.
,
.

.
.
'
.
16

.....
While (....) do

......

If (...) then

...
Else

...
End if

Repeat
...
...
Until (...)
End While

..
.

TEXNIKE


:

( declarations) ,
.

, , ,

.
-
(main, program ).
, ( / )
. .
(if-thenelse)
(for, while, repeat).
( - data) ,

( ).
, .
, ,
.
() / ,
, .
17

,
. ,
.
,
, ,
. .
:
1. : .
2. : .
3. : .
.
() ,
.
:
C
Pascal
Java
Fortran 77

int
integer
int
INTEGER

Float
Real
double
REAL

char
char
string
CHARACTER
,

.
.
.
( Pascal C) (procedures
PASCAL) / - (FORTRAN) (paragraphs COBOL).

BOOL
Bool ( 19 )
: (True) (False) (Boolean
logic). ,
, / (1/0) .
Bool,
( ) (, . ,
) .
,
, ( 5+3, 7- 4, 5x2, 20/4). Bool
,
(AND), (OR) ().
:
4 3 (4>3 )
.
:
40
( 40, )
. 40 ,
.
:
60 180.000
.
AND, OR NOT Bool
, V . :

AND

OR

NOT

T
T
F
T
T
T
F
T
F
F
F
F
T
F
Bool, ,
( )
.
() :
= (),
< (),
18

> (),
( ),
( )
().
Bool
:
< 100.000 < 60
> 56 < 20
> 40o < 75 o
< 45% > 20%
[( > 40o) ( < 10%)] ( > 8000lt)

,
.
C
&&

Pascal
AND

Java
&

FORTRAN
.AND.

AND
OR
||
OR
||
.OR.
NOT
!
NOT
!
.NOT.
=
==
=
==
.EQ.
>
>
>
>
.GT.
<
<
<
<
.LT.

>=
>=
>=
.GE.

<=
<=
<=
.LE.

!=
<>
!=
.NE.
,
.
(, )
( )
( ) , :

C
if (temp > 30 && temp <60)
{
mask = 5;
printf (mask is 8 now\n);
}
else
mask = 7;
While () {
()
}

Pascal
if (temp > 30 AND temp < 60) then
begin
mask := 5;
writeln (mask is 8 now);
else
mask:=7;
While () do
begin
()
end;



.

:
1.
( ,
)
2. ( )
, .
3. ,
, (compilation)
( .. C, PASCL, COBOL,
FORTRAN )
,
,
19

. (),
.
(algorithm) , / ,
,
( ).
, .
/
( ).
/
( ).
()
.
,
. ,
( ).
; ,
. (
) , :
1. (
).
2. .
3. ,
.
4. , ,
.
:
7, 5, 11, 12, 3 9 :
- 7 . .
- 5. 7 5 7 .
- 11. 11 > 7 11 .
- 12. 12 > 11 12 .
- 3. 12
- 9, 12 .

.
.

.
:
0. MAX
.
1. .
2. MAX .
3. .
4. ; , . .
5. > ; , , 3
()
:
(...) ,
.
, .
0 .
:
0.
.
1.
. .
2.
= 0 .
3.
, . 1.

.
,
.
:
20


"" :
1. .
2. .
3. ,
3. ;
3. : ; 3.
3. : ; 2.
3. 1.
:

,
. (flowcharts),
( ), .
:


().


(flowcharts)
.
21


( / ), .

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

.

.


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

.

:
22


:
:
:
_:
/




5
30

()
/ ( )
()
()
/ ( )

/ ( )
()
()
/
/
()
()
/
()

/
()
/
_ ()
/
()
()
_ ()


( Bool).

/
( ).

(1, 2, )
.
x, !

(o)
(array) (data, )
, .
.
,
( )
, ..
= (1, 5, 7, 10) 1=1 ( ), 3=7 (
)
,
.
.
n .
23

- :
= 1, 2,..., n
= 1, 2,..., n
C:
C= 1+1, 2+2,...,n+n
:
_.
0.
1. , , C:
:
i: ()
2. , i 1
2. (i <= N )
Ci Ai + Bi
ii+1
()
3. C
B4.


( , searching). :
10 , ;
- .
.
:
-1.
0.
1. : , : , i: ()
3. , , i 1
4. (i <= )
(i = )

()
ii+1
()
5.
. ,
. ,
, .
.
met, 0 ()
:
-2.
0.
1. : , : , i, met: ()
3. ,
i <- 1, met=0
4. (i <= )
(i = )
met met+1
()
ii+1
()
B5. (met > 0)
met


6.
, met .

24



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

.
,
. ;
.

. ;
,
(. 99999).
. :
=(8, 256, 37, 1, 45). =( , , , , )
. 1. 1 .
1 999. :
= (8, 256, 37, 999, 45) =(1, , , , )
. 8.
:
= (999, 256, 37, 999, 45) =(1, 8, , , )
:
= (999, 999, 999, 999, 999) =(1, 8, 37, 45, 256)
.
:
-
0.
1. : , : ( )
j, k, i: (j, i )
2. , i 0
3.
i i +1
min A1 ( 1 )
j2
(j <= N)
(min > Aj)
min Aj
kj
()
j = j+1
()
Bi Ak
Ak
()
4.
5.
() :

B.
,
. :

8, 256, 37, 1, 45

25

. 1. 1 8
1 8. :
1, 256, 37, 8, 45
,
256, 37, 8, 45.
( 8)
( 256). :
1, 8, 37, 256, 45
37, 256, 45 .

. ,
. ,
. k
m n
( m n ).
MIN (A, m, n, k)
1. : , k: ( )
m: ( ), n: ( ), j: ()
B2. min Am, k m, j m+1
B3. (j <= n)
(min > Aj )
min Aj
k j
()
j j+1
()
4. ()

:
_
0.
1. A: , , K, i, temp: ( )
B2. , i 1
3. (i < N)
MIN(A, i, N, K)
temp Ai
Ai AK
AK temp
i i+1
()
4.
5.
;
.
;
() ( ).
() 3 (;)

.
, temp.
() Bubble sort:
bubble sort ( ;).
:
7, 5, 2, 11, 8
bubble sort :
.
.

.
.
.
26

- 7 5. 5 . :
5, 7, 2, 11, 8
- 7 2 . 2 :
5, 2, 7, 11, 8
- 7 11. .
- 11 8 . :
5, 2, 7, 8, 11
"" :
2, 5, 7, 8, 11
2 5 .
.
:
UBLE_SORT
0.
1. : , i, k, temp, flag: (i, k )
2. , i 1
3. (i <= N)
k 1, flag 0
-1
(k+1 < k)
temp k , k k+1 , k+1 temp ()
flag 1 ( 1 )
()
k k +1
()
(flag = 0) i N+1 ( )
i i+1
()
()
4.
5.
: binary search.
,
,
. binary
search. .
( ) .
( ) , (
) ( )
. (
) ( ) .
.
A
= ( 1, 2, 4, 7, 11, 16, 22, 29, 37) - 9
29 .

1 = ( 1, 2, 4, 7)
2 = (11, 22, 29, 37)
29 7 11 ( ) 2.
2 -:
A21 = (11, 22)
A22 = (29, 37)
o 29 22 22 (
).
22 :
221 = (29)
222 = (37)
221 .
,
. ( )
27

.
:
binary_search
0.
1. : , M: ( )
, , i, , flag:
B2.
3. 1,
(+)/2
4. (flag = 0 A > )
(K = ) flag=1, ()
(K < )
+1

-1
()
()
5. (flag = 1)


()
6.

28

You might also like