Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf28d1a2

Browse files
authored
Merge pull request#1474 from aleksmish/patch-1
fix typo
2 parents0da3b79 +77381f8 commitf28d1a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/graph/mst_prim.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void prim() {
147147
```
148148

149149
The adjacency matrix`adj[][]` of size $n \times n$ stores the weights of the edges, and it uses the weight`INF` if there doesn't exist an edge between two vertices.
150-
The algorithm uses two arrays: the flag`selected[]`, which indicates which vertices we already have selected, and the array`min_e[]` which stores the edge with minimal weight toan selected vertex for each not-yet-selected vertex (it stores the weight and the end vertex).
150+
The algorithm uses two arrays: the flag`selected[]`, which indicates which vertices we already have selected, and the array`min_e[]` which stores the edge with minimal weight toa selected vertex for each not-yet-selected vertex (it stores the weight and the end vertex).
151151
The algorithm does $n$ steps, in each iteration the vertex with the smallest edge weight is selected, and the`min_e[]` of all other vertices gets updated.
152152

153153
###Sparse graphs: $O(m \log n)$

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp