09.07.2015 Views

slides - Computer Science - University of San Francisco

slides - Computer Science - University of San Francisco

slides - Computer Science - University of San Francisco

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

17-45: Dijkstra Running TimeTotal time for all calls to minUnknownVertex, andsetting T[v].known = true (for all iterations <strong>of</strong> theloop)for (i=0; i < G.length; i++) {v = minUnknownVertex(T); < These two linesT[v].known = true; < ---------------for (e = G[v]; e != null; e = e.next) {if (T[e.neighbor].distance >T[v].distance + e.cost) {T[e.neighbor].distance = T[v].distance + e.cost;T[e.neighbor].path = v;}}}Θ(V 2 )

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

Saved successfully!

Ooh no, something went wrong!