Skip to content

Commit 24bac5b

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

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -2054,12 +2054,11 @@
20542054
- T(Find) = T(Union) = O(log|V|)
20552055
- T(n) = O(|V|) + O(|E|Log|V|) + O(|E|Log|V|) + O(|V|Log|V|) = O((|E| + |V|) log|V|)
20562056
- **T(n) = O((|E|) log|V|)**
2057-
- If |E| is given **sorted** and Disjoint set is implemented with **Compression Heuristic**
2057+
- If E is given already **sorted** and Disjoint set is implemented with **Compression Heuristic**
20582058
- T(Sorting E) = O(1)
20592059
- T(Find) = T(Union) = O(log*|V|)
20602060
- T(n) = O(|V|) + O(1) + O(|E|log*|V|) + O(|V|log*|V|) = O(|V|) + O((|E| + |V|) log*|V|) = O(|V|) + O((|E|log*|V|)
2061-
- **T(n) = O((|E|log*|V|)**
2062-
- It's **linear**!
2061+
- T(n) = O((|E|log*|V|): it's **linear**!
20632062
- Related Problems:
20642063
- Building a network
20652064
- [Building Roads to Connect Cities](https://github.com/hamidgasmi/training.computerscience.algorithms-datastructures/issues/136)
@@ -2098,9 +2097,9 @@
20982097
{The resulted MST is in parent}
20992098
- T(n) = |V| T(ExtractMin) + |E| T (ChangePriority)
21002099
- Array-based implementation: O(|V|^2)
2101-
- Binary heap-based-based implementation: O((|V| + |E|) log |V|) = O(|E| log |V|)
2102-
- In case of a **sparse graph** (|E| ≈ |V|): **Binary Heap implementation is more efficient**: **T(n) = O(|V|)*Log|V|)**
2103-
- In case of **dense graph** (|E| ≈ |V|^2): **Array implementation is more efficient**: **T(n) = O(|V|^2)**
2100+
- Binary heap-based implementation: O((|V| + |E|) log |V|) = O(|E| log |V|)
2101+
- In case of a **sparse graph** (*|E| ≈ |V|*): **Binary Heap implementation is more efficient**: **T(n) = O(|V|)*Log|V|)**
2102+
- In case of **dense graph** (*|E| ≈ |V|^2*): **Array implementation is more efficient**: **T(n) = O(|V|^2)**
21042103
- Related Problems:
21052104
- Building a network
21062105
- [Building Roads to Connect Cities](https://github.com/hamidgasmi/training.computerscience.algorithms-datastructures/issues/136)

0 commit comments

Comments
 (0)