Sunteți pe pagina 1din 7

1.

347

43

347(10)>533(8)
533

2755
3

172
12=C

10
10=A

2755(10)->AC3(16)
AC3

20

10

0
2.

1000101

26

25

24

357

82

22

81

C7A

23

162
12

161

160

21

20

357(8)=

80

20(10)>10100(2)
10100
1000101(2)=69(10)
64+4+1=69
357(8)=239
(10)
192+40+7
=239

C7A(16)=3194(
!0)
3072+112+10
=3194

10

3.
FA + 23

11010010(
2)+
11101101(
2)
1176(8)723(8)

15+2=17

11

10+3=13

0+
1= 1
1

1+
0=1
1

6-3=3

0+1=1

1+0=1

7-2=5

1+0
=1
1

11-7=4

0+1
=1
1

FA(16) + 23(16) =
11D(16)

1+1
=0
0

2+1
=1
11

453

4.
10101010,1100
10(2)

010

101

010

110

010

=>110111
111

1010

1010

1100

1000

1100010,1110
10(2)
142,72(8)

001

100

010

111

010

1100010,1110
10(2)
62,E8(16)
5.

0110

0010

1110

1000

252,62(16)
10101010,1100
10(2)
AA,C8(16)

175,1285
6.

Quick Sort
{
Input X[i], I=0,,N-1
Input val
nceput = 0
sfrit = N-1
mijloc = (nceput + sfrit) / 2
While ((nceput <= sfrit) AND (val <> X[mijloc])) Do
if val < X[mijloc] then
sfrit = mijloc 1
else
nceput = mijloc + 1
mijloc = (nceput + sfrit) / 2
EndWhile
If X[mijloc] = val Then

Output mijloc
Else
Output Nu am gsit valoarea dat
EndIf
}

Bubble sort
{
Input n, x[i], i=0,n-1
Do
{
Ok =1;
For(i=0 t n-2) do
If (x[i] > x[I + 1]) then
aux = x[i];
x[i] = x[i + 1];
x[i + 1] = aux;
ok = 0;
endif;
endfor;
while(ok = 0)
output x[i] , i = 0; I = 0,n-1
}

7.
{
Input n1, n2
If n1 > n2 Then
deimp = n1
imp = n2
Else
deimp = n2
imp = n1
EndIf
rest = imp
While rest != 0 Do
rest = deimp modulo imp
deimp = imp
imp = rest
EndWhile
Output deimp
}

8.
{
Input n
For i=2 to n do
prim=1
For j=2 to i/2 do
If i modulo j=0 then
prim=0
EndIf
EndFor
If prim=1 then
output i,' '
EndIf
EndFor

9.
Inmultirea chinezeasca
{
Input nr1,nr2
While(nr1 <> 0 )
{
Lungime++;
nr1=nr1 / 10;
}
While(nr2 <>0)
{
Lungime2++;
Nr2=nr2 / 10;
}
For (i=0, i<lungime1 , i++) do
For (j=0 ,j <lungime2,j++) do
Mat[i][j] = nr1 * nr2;
Endfor;
Endfor;
For (i= 0 to lungime 1)
For (j = 0 to lungime2)
Citeste de pe diagonale si adauga la urmatorul daca trece de 9 si adauga intr un
vector numerele
Endfor;
Endfor;

Output (for i=max vector, i > 0, i--) afisam vector invers;


}

S-ar putea să vă placă și