29.06.2013 Views

Curs 8 - Drumuri de cost minim [pdf] - Andrei

Curs 8 - Drumuri de cost minim [pdf] - Andrei

Curs 8 - Drumuri de cost minim [pdf] - Andrei

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.

Problema Dijkstra<br />

Exemplu rulare<br />

d[a] = 0; d[b] = d[c] = d[d] = ∞<br />

d[b] = 3; 3 d[d] = 5; 5<br />

d[c] = 11;<br />

d este extras din coadă! In momentul extragerii din coadă<br />

distanța pană la nodul d se consi<strong>de</strong>ră a fi calculată si a fi<br />

optimă.<br />

Se extrage nodul c; d[d] nu va mai fi actualizată – nodul d<br />

fiind <strong>de</strong>ja eliminat din coadă.<br />

Algoritmul nu funcționează pentru grafuri ce conțin<br />

muchii <strong>de</strong> <strong>cost</strong> negativ!<br />

Proiectarea Algoritmilor 2010<br />

Exemplu practic – muchii <strong>de</strong> <strong>cost</strong><br />

negativ (I)<br />

*sli<strong>de</strong> din cursul <strong>de</strong> algoritmi <strong>de</strong> la Princeton – Sedgewick&Wayne[1]<br />

Proiectarea Algoritmilor 2010<br />

a<br />

5<br />

3<br />

d<br />

b<br />

-7<br />

8<br />

c<br />

5/8/2010<br />

4

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

Saved successfully!

Ooh no, something went wrong!