Before you keep reading...
Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.
Before you keep reading...
Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.
7.21. Análisis del algoritmo de Dijkstra
Finalmente, veamos el tiempo de ejecución del algoritmo de Dijkstra. Notamos en primer lugar que construir la cola de prioridad toma un tiempo ya que inicialmente agregamos cada vértice del grafo a la cola de prioridad. Una vez construida la cola, el ciclo while
se ejecuta una vez para cada vértice, ya que los vértices son todos agregados al principio y sólo se eliminan después. Dentro de ese ciclo, cada llamada a eliminarMin
toma un tiempo . En conjunto, esa parte del ciclo y las llamadas a eliminarMin
toman un tiempo . El ciclo for
se ejecuta una vez por cada arista en el grafo, y dentro del ciclo for
la llamada a decrementarClave
toma un tiempo . Así que el tiempo de ejecución combinado es .
You have attempted
1 of
1 activities on this page