Here's the problem. How do I get to the nth- er, the k'th element in the list, in this case?
如何找到第n个元素呢-,在这里,如何找到第k个元素呢?
Just swapping them, right? I temporarily hold on to what's in the i'th element so I can move the i plus first one in, and then replace that with the i'th element.
交换他们,对么?,临时的保存下第i个元素,然后把第i+1个元素移进来,把i+1的位置替换为第i个元素。
His adventurous song is one that "with no middle flight intends to soar above th' Aonian Mount, while it pursues things unattempted yet in Prose or Rhyme."
他那具有冒险精神的诗歌,“抛开了中途的旅程,要一飞冲天越过爱奥尼神山,同时追寻使用在未经使用的韵律“
I've got to count my way down, which means that the access would be linear in the length of the list to find the i'th element of the list, and that's going to increase the complexity.
的位置并去访问,然后继续下去,也就意味着,找到数组中的第i个元素的方法,是关于数组的长度呈线性复杂度的,这回增加算法的复杂度。
Where n'th is somewhere between and 2 in this case.
而在这个例子中第n个元素,就是2和5之间的一个数。
应用推荐