Algorithm Design and Complexity

Notiță
7/10 (1 vot)
Domeniu: Calculatoare
Conține 1 fișier: pdf
Pagini : 4 în total
Cuvinte : 3394
Mărime: 149.36KB (arhivat)
Publicat de: Robert Andrei
Puncte necesare: 5
Profesor îndrumător / Prezentat Profesorului: Nicolae Tapus
Fituici Algorithm Design and Complexity. FILS (Facultatea de Inginerie cu Predare in Limbi Straine). Anul V. Semestrul II.

Extras din notiță

24.3 Dijkstra's algorithm Dijkstra's algorithm solves the single-source shortest-paths problem on a weighted, directed graph G = (V, E) for the case in which all edge weights are nonnegative. In this section, therefore, we assume that w(u, v) e 0 for each edge (u, v) _ E. As we shall see, with a good implementation, the running time of Dijkstra's algorithm is lower than that of the Bellman- Ford algorithm. Dijkstra's algorithm maintains a set S of vertices whose final shortest-path weights from the source s have already been determined. The algorithm repeatedly selects the vertex u _ V – S with the minimum shortest-path estimate, adds u to S, and relaxes all edges leaving u. In the following implementation, we use a min-priority queue Q of vertices, keyed by their d values. DIJKSTRA(G, w, s) 1 INITIALIZE-SINGLE-SOURCE(G, s) 2 S  Ø 3 Q  V[G] 4 while Q ` Ø 5 do u  EXTRACT-MIN(Q) 6 S  S _{u} 7 for each vertex v _ Adj[u] 8 do RELAX(u, v, w) Dijkstra's algorithm relaxes edges as shown in Figure 24.6. Line 1 performs the usual initialization of d and À values, and line 2 initializes the set S to the empty set. The algorithm maintains the invariant that Q = V - S at the start of each iteration of the while loop of lines 4- 8. Line 3 initializes the min-priority queue Q to contain all the vertices in V ; since S = Ø at that time, the invariant is true after line 3. Each time through the while loop of lines 4-8, a vertex u is extracted from Q = V - S and added to set S, thereby maintaining the invariant. (The first time through this loop, u = s.) Vertex u, therefore, has the smallest shortest-path estimate of any vertex in V - S.

Preview document

Algorithm Design and Complexity - Pagina 1
Algorithm Design and Complexity - Pagina 2
Algorithm Design and Complexity - Pagina 3
Algorithm Design and Complexity - Pagina 4

Conținut arhivă zip

  • Algorithm Design and Complexity.pdf

Alții au mai descărcat și

Bază de date Access - evidența salariaților

SISTEME DE GESTIUNE A BAZELOR DE DATE Sistemele de gestiune a bazelor de date (în limba engleză "database management system" - SGDB) reprezintă...

Arhitectura calculatoarelor - Intel vs AMD

Rezultatele din testul 3DS Max 7 SPECapc Test Testul alaturat consta in crearea modelelor 3D, modificarea si randarea scripturilor. Conform...

Proiectarea și Analiza Algoritmilor

//Varianta A: Arbori B :structura , cel mai lung cuvant,cel mai mare cuvant din arbore. #define N 2 #define M 4 //Strunctura necesara pentru...

Autentificarea prin semnătură digitală

Introducere O semnatura digitala reprezinta o informatie care il identifica pe expeditorul unui document. Semnatura digitala este creata prin...

Sistem de Prognosticare a Unei Avarii

Acest sistem calculeaza gradul de avariere a unei cladiri în cazul unui cutremur, precum si posibila necesitate a reconstructiei cladirii (partiala...

Structuri de Date și Algoritmi

De ce SDA? Structuri de date : metode de organizare a unei mari cantitati de informatie Analiza algoritmilor : estimarea timpului de executie si...

Te-ar putea interesa și

Sisteme Electronice Programabile

INTRODUCERE Interacţia cu sfera obiectelor tehnice se realizează astăzi, din ce în ce mai mult prin gestul binar al tastării. Apăsam sau nu pe...

Ai nevoie de altceva?