【发布时间】:2018-04-25 12:57:36
【问题描述】:
所以我的疑问是在第 2 行,这里我们可以假设 array2 嵌套在 array1 中,从 O(n^2) 或 O(n) 那里的时间复杂度是多少?
function1()
{
for-loop1{ function2(); } //line 2
}
function2()
{
for-loop2();
}
【问题讨论】:
-
我们需要看看这些函数在做什么。
-
当然会包含在内。
-
欢迎来到 StackOverflow。请按照您创建此帐户时的建议阅读并遵循帮助文档中的发布指南。 On topic 和 how to ask 在这里申请。 StackOverflow 不是设计、编码、研究或教程服务。
-
您发布的代码的复杂度为 O(1):由于语义错误,它会在恒定时间内失败。
array1和array2未定义。
标签: java arrays algorithm time-complexity