Skip to content

Commit 2b97ba9

Browse files
author
Hamid Gasmi
committed
Prim's algorithm description is added
1 parent 24bac5b commit 2b97ba9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2095,9 +2095,9 @@
20952095
parent[z] ← v
20962096
ChangePriority(PrioQ, z, cost[z])
20972097
{The resulted MST is in parent}
2098-
- T(n) = |V| T(ExtractMin) + |E| T (ChangePriority)
2099-
- Array-based implementation: O(|V|^2)
2100-
- Binary heap-based implementation: O((|V| + |E|) log |V|) = O(|E| log |V|)
2098+
- *T(n) = |V| T(ExtractMin) + |E| T(ChangePriority)*
2099+
- Array-based implementation: *O(|V|^2)*
2100+
- Binary heap-based implementation: *O((|V| + |E|) log |V|) = O(|E| log |V|)*
21012101
- In case of a **sparse graph** (*|E| ≈ |V|*): **Binary Heap implementation is more efficient**: **T(n) = O(|V|)*Log|V|)**
21022102
- In case of **dense graph** (*|E| ≈ |V|^2*): **Array implementation is more efficient**: **T(n) = O(|V|^2)**
21032103
- Related Problems:

0 commit comments

Comments
 (0)