08.10.2013 Views

Algorithme et Structures de Données

Algorithme et Structures de Données

Algorithme et Structures de Données

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Exercice avec O(N) (4.1)<br />

• <strong>Algorithme</strong> :<br />

– Initialisation exécutée 1 fois (temps : a1 ns)<br />

– une boucle interne parcourue 2N*HN (temps : a2 ns; avec HN le nombre harmonique)<br />

– une section supplémentaire exécutée N fois<br />

(temps : a3 ns)<br />

• Temps moyen d'exécution <strong>de</strong> l'algorithme?<br />

• a1 + 2a2N*HN + a3*N ns<br />

Exercice avec<br />

O(N) (4.2)<br />

1 1 1<br />

H N = 1+<br />

+ + ... +<br />

2 3 N<br />

1<br />

≈ ln N + γ<br />

+<br />

12N<br />

• Avec la notation O(N) que <strong>de</strong>vient c<strong>et</strong>te estimation ?<br />

a1 + 2a2N*HN + a3 *N ns<br />

• 2a2N*HN + O(N)<br />

• Une forme plus simple qui indique que ce n'est pas la peine<br />

<strong>de</strong> chercher a1 <strong>et</strong> a3 • Temps d'exécution exprimer en notation « grand-O » ?<br />

• HN =ln(N) + O(1) on obtient ainsi 2a2N*Ln(N)+ O(N)<br />

• l'expression asymptotique du temps total d'exécution :<br />

temps proche <strong>de</strong> 2a2N*Ln(N) pour <strong>de</strong>s N grands

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!