【发布时间】:2012-08-14 16:45:36
【问题描述】:
我的算法如下图所示。它对服务器进行远程调用并获取结果处理它们,然后再次将远程调用发送到系统。你能告诉我这个算法的时间和空间复杂度是多少吗?
Get search keyword from user
ϕ := getInfoFromConceptNet(keyword) // makes remote call
e := expandConcepts(ϕ)
expConcepts := {} // adds to an array
for each ec in e // first loop
expConcepts.add(ec) // adds to array
α= expandConcept(ec) //remote call
expConcepts.add(α) // adds to array
αkeywords=getKeywords(α) // calls a function to remove stopwords
for each αkw in αkeywords // second loop
Ω= expandConcept(αkw) // makes remote call
expConcepts.add(Ω) // adds to an array
results[ ]=performsearch(expConcepts,additional information) // searches the array
【问题讨论】:
-
你能正确缩进你的 for 循环吗?即使在您的原始帖子中,我也无法弄清楚缩进。我只是编辑它以删除多余的空格以使其更易于阅读。
标签: algorithm time-complexity space-complexity