<p>我在班上有一次测验,成绩不太好。我想知道是否有人能向我解释我在这里做错了什么——我们搬到网上后,我们的教授办公时间太多了,所以我想我应该在这里发帖</p>
<pre><code>def functionB(n):
for i in range(1,6):
for j in range(i,6):
n = n // 2
return n
</code></pre>
<p>我的回答如下:</p>
<blockquote>
<p>The above function is O(n^2) because of the nested for-loops. Although
the value of n is being cut in half upon each iteration, it does not
have an impact on the actual run time of the code.</p>
</blockquote>
<p>我得到了3/10的分数,但不幸的是没有任何解释,所以我不确定我错了什么,为什么。这里有人能向我解释正确答案吗</p>