【发布时间】:2019-09-19 18:18:12
【问题描述】:
考虑:
def fun(n):
for i in range(1, n+1):
for j in range(1, n, i):
print (i, “,”, j)
我在使用嵌套的 for 循环时遇到问题。是 2n^2 + 2n + 1 吗?
【问题讨论】:
-
注意
i作为步骤。 -
@CeliusStngher:上面不是完全重复的,因为这里的步骤是
i,而不是1。
标签: python time-complexity big-o