So this line or these lines of code up here are arguably constant time steps to say if N is less than 2 in return, that it will always take maybe one step, maybe two steps, some number of fixed CPU cycles.
如果N小于2并返回,那么这些行所对应的代码,通常只需要执行一步,或者两步,具体数字与CPU周期有关。
n Alright. So if n is less than or equal to 1, return n. Well that's not right, right?
好吧,如果n小于等于1,它会返回,这里不对,是吧?
Suppose someone has been investing money for n years and xi is the return on the investment in a given year.
假设有人投资了n年,Xi是第i年的收益率
So given some input of N elements, first, if N is less than 2, I return immediately.
给出N个元素的一些输入,首先,如果N小于,就立即返回。
应用推荐