DS 02 d`informatique (devoir sur table) Durée : 2h30.

2 10 2 1010011012
2
612 = 2 ×306 + 0
306 = 2 ×153 + 0
153 = 2 ×76 + 1
76 = 2 ×38 + 0
38 = 2 ×19 + 0
19 = 2 ×9 + 1
9=2×4 + 1
4=2×2 + 0
2=2×1 + 0
1=2×0 + 1
6122= 1001100100
10100110121+0×2+1×4+1×8+0×16 + 0 ×32 + 1 ×64 + 0 ×128 + 1 ×256 = 333
16 1234 2
1234 0000010011010010
11111111111111110000010011010010 = 1111101100101101 1 1111101100101110
16 6
0.42
0
2
0.42 ×2=0.84 <1
0.84 ×2=1.68 >1
2 = 1111102
0.68 ×2 = 1.36
0.36 ×2 = 0.72
0.72 ×2 = 1.44
0.44 ×2 = 0.88
0.88 ×2 = 1.76
0.76 ×2 = 1.52
0.52 ×2 = 1.04
0.04 ×2 = 0.08
0.08 ×2 = 0.16
9 1.00
0111110101011100
0.42
21
50
M
2n
100000
(Fn)nN
F0= 0, F1= 1,nN, Fn+2 =Fn+1 +Fn.
n Fn
8
O(f(n)) f
a b
a b
3705 513 1,2,3,· · · ,512,513
3705
513
a b 57
compteurk
k compteurk+1 =compteurk1 (compteurk)k
compteur0=n
xnN
resultatk
resultat k
(resultatk+1 xcompteurk+1 )%N= (((resultatkx)%N)xcompteurk1)%N= (resultatkxxcompteurk1)%N
resultatn=resultatnx0%N=resultatnxcompteurn%N=
resultat0xcompteur0%N= 1 xn%N=xn%N
n0N1
N x
n
n
[5,2,3,1,4]
n= 5
i= 1 x= 2 [2,5,3,1,4]
i= 2 x= 3 [2,3,5,1,4]
i= 3 x= 1 [1,2,3,5,4]
i= 4 x= 4 [1,2,3,4,5]
n1
{L[0], . . . , L[n1]}
P(k)i=k LkL
Lk[0 : k+ 1] L0[0 : k+ 1] Lk[k+ 1 :] = L0[k+ 1 :]
L0[0 : 0 + 1] L0[0] P(0)
i= 0 i= 1
P(k)k+ 1 6n
j k + 1
L[j]Lk+1[k+ 2 :] = Lk[k+ 2 :] = L0[k+ 2 :] P(k)
Lk[0 : k+ 1] = [x0,...xk]x06· · · 6xkj k + 1
x=Lk[k+ 1] = L0[k+ 1] j Lk[j]6x
L[0 : k+ 1] [x0,· · · xj, xj,· · · xk]
Lk+1[0 : k+ 1] = [x0,· · · xj1, x, xj,· · · xk]Lk[0 : k]+[x] = Lk[0 : k+ 1]
P(k)L0[0 : k+ 1]
P(k)
O(f(n)) f
i1 2i
i1n1
n1
X
i=1
2i= 2n(n1)
2=O(n2)
1 / 5 100%
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans l'interface ou les textes ? Ou savez-vous comment améliorer l'interface utilisateur de StudyLib ? N'hésitez pas à envoyer vos suggestions. C'est très important pour nous!