Untitled

tobiasc.dk

Untitled

G

n

a z

i := 1 n

L(vi) := ∞


L(a) := 0

S := ∅

w(vi, vj) = ∞ w(vi, vi) = 0

z /∈ S

u := S L(u)

S := S ∪ u

v S

L(u) + w(u, v) < L(v)

L(v) := L(u) + w(u, v)


S

S




O(n 2 ) n

G

n n

n − 1


n · (n − 1) + n = n 2 − n + n = n 2

O(n 2 )

Similar magazines