This shows you the differences between two versions of the page.
pa:laboratoare:laborator-09 [2023/06/10 18:58] radu.nichita [Exemple] |
pa:laboratoare:laborator-09 [2025/05/21 17:19] (current) matei.mantu fix typo |
||
---|---|---|---|
Line 164: | Line 164: | ||
==== Complexitate ==== | ==== Complexitate ==== | ||
- | * **complexitate temporală**: $T = O(n^3)\ sau\ O(|E|^3)$ | + | * **complexitate temporală**: $T = O(n^3)\ sau\ O(|V|^3)$ |
* **complexitate spațială** : $S = O(1)$ | * **complexitate spațială** : $S = O(1)$ | ||
Line 199: | Line 199: | ||
Johnson(G=(nodes, adj)) { | Johnson(G=(nodes, adj)) { | ||
// STEP 1: Compute adjustment distances h (using Bellmand-Ford). | // STEP 1: Compute adjustment distances h (using Bellmand-Ford). | ||
- | has_cycle, h = ComputerH(G); | + | has_cycle, h = ComputeH(G); |
if (has_cycle) { | if (has_cycle) { | ||
return true, null, null; | return true, null, null; | ||
Line 437: | Line 437: | ||
</note> | </note> | ||
- | ==== Roy-Floyd ==== | + | ==== Task-1: Roy-Floyd ==== |
Se dă un graf **orientat** cu **n** noduri. Graful are **costuri strict pozitive**. | Se dă un graf **orientat** cu **n** noduri. Graful are **costuri strict pozitive**. | ||
Line 460: | Line 460: | ||
</note> | </note> | ||
- | ==== Johnson ==== | + | ==== Task-2: Johnson ==== |
Se dă un graf **orientat** cu **n** noduri. Graful are **costuri oarecare** (pot fi și negative). | Se dă un graf **orientat** cu **n** noduri. Graful are **costuri oarecare** (pot fi și negative). | ||
Line 484: | Line 484: | ||
</note> | </note> | ||
+ | |||
+ | === Task-3: Orașul care poate accesa cele mai puține noduri (dându-se o distanță limită) === | ||
+ | Rezolvați problema [[ https://leetcode.com/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/description/ | Find the City With the Smallest Number of Neighbors at a Threshold Distance ]] pe LeetCode. | ||
+ | |||
==== BONUS ==== | ==== BONUS ==== |