time-complexity - 图算法的运行时间
问题描述
我对以下算法的运行时间计算有疑问我不确定我的答案,我想检查正确的答案
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
解决方案
推荐阅读
- node.js - Jimp:从 24 位 bmp 获取像素的 rgb 颜色
- asp.net - 服务器上的 .net 5.0 项目每隔几个小时启动一次,为什么?
- jetty - 如何使用 RSA 加密对 ActiveMQ Web 控制台(码头)进行加密?
- ms-access - 访问表达式,加一年,减一天
- varnish - 为 Varnish 安装 VMOD basic-auth
- c++ - C ++:对模板类型列表进行映射操作
- c# - FASTER 可以(轻松)用作 ACID 数据库吗?
- sql - 使用单个查询从两个表中获取行
- deep-learning - Yolo V3:图片中混合类时性能不佳
- excel - 如何将 xls 文件导出到从文件夹中读取它们的 txt 文件(Visual Basic)?