我对以下算法的运行时间的计算有疑问 我不确定我的答案,我想检查正确的答案
Algorithm Unknown(G)
Input: A weighted graph with n vertices, and m edges
Output: ?????
P ← create array of size n to to referenced by vertix id number (id[u])
Q ← create array of size n to to referenced by vertix id number.
for each u ∈ G.vertices() do
Q[id(u)] ← null
for each v ∈ G.vertices() do
for each u G.vertices() do
if G.areAdjacent(u,v) then
P[id(u)] ← -∞
for each u ∈ G.vertices() do
for each e ∈ G.incidentEdges(u) do
z ← G.opposite(u,e)
if G.valueAt(e) > P[id(z)] then
P[id(z)] ← valueAt(e)
Q[id(z)] ← e
return Q