File tree 1 file changed +5
-6
lines changed
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 2054
2054
- T(Find) = T(Union) = O(log|V|)
2055
2055
- T(n) = O(|V|) + O(|E|Log|V|) + O(|E|Log|V|) + O(|V|Log|V|) = O((|E| + |V|) log|V|)
2056
2056
- ** 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**
2058
2058
- T(Sorting E) = O(1)
2059
2059
- T(Find) = T(Union) = O(log* |V|)
2060
2060
- 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** !
2063
2062
- Related Problems:
2064
2063
- Building a network
2065
2064
- [ Building Roads to Connect Cities] ( https://github.com/hamidgasmi/training.computerscience.algorithms-datastructures/issues/136 )
2098
2097
{The resulted MST is in parent}
2099
2098
- T(n) = |V| T(ExtractMin) + |E| T (ChangePriority)
2100
2099
- 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)**
2104
2103
- Related Problems:
2105
2104
- Building a network
2106
2105
- [ Building Roads to Connect Cities] ( https://github.com/hamidgasmi/training.computerscience.algorithms-datastructures/issues/136 )
You can’t perform that action at this time.
0 commit comments