N But it's definitely not one and in fact it wasn't N in the case of Selection Sort because remember the algorithm we implemented on stage last week had me going back and forth across the stage selecting on iteration, the smallest person I can find, the smallest number and then putting them into place.
但在选择排序中,肯定不会是1,也不是,注意,上周我们在这儿,实现的算法中,反复地,迭代进行选择,选出最小的数,然后将其放在合适的位置。
In the case of Nimes, N-I-M-E-S, which was largely a Protestant town, they knocked down the wall so the Protestants of Nimes could not defend themselves against this all-conquering Catholic monarch.
以尼姆为例,那儿曾经是一座新教徒的城市,但统治者们拆毁了围墙,所以新教徒们再也无法对抗,所向无敌的天主教统治者了
Here's the problem. How do I get to the nth- er, the k'th element in the list, in this case?
如何找到第n个元素呢-,在这里,如何找到第k个元素呢?
And that in the case of constant volume, U in this case that's my delta u, and then I'll H add my little delta n term to get delta H.
这是在等体情形下,此时的到的是Δ,然后我可以加上Δn的项来得到Δ
So the normal--the bell-shaped curve in that case for the x/n is going to look something like this.
那么x/n的钟形曲线,大概就会是这个样子
So I propose this as a new algorithm for sorting N elements and being 8 in this case or really a thousand in the case of the phonebook, or anything of larger size.
所以我提出一种新的算法,来解决N个元素的排序问题,在这个问题中N是8,在电话簿的问题中N是一千,或者是大规模的任何问题。
So, if, for example, we were looking at a hydrogen atom in the case where we have the n equals 1 state, so the electron is in that ground state, the ionization energy, it makes sense, is going to be the difference between the ground state and the energy it takes to be a free electron.
电离氢原子所需要的能量,如果我们看n等于1的情况,电子在基态,那电离能,很合理的就是基态,和自由电子态的能量差。
In the linear case, meaning in the unsorted case what's the complexity of this? k times n, right? Order n to do the search, and I've got to do it k times, so this would be k times n.
复杂度是多少?k的n次方,对吧?,在序列n中做搜索,要做k次,所以是k的n次方次,如果先排序后搜索。
Thank you. Sorry, I've got the wrong glasses on but you're absolutely right, and in case the rest of you didn't hear it, n squared.
我看不清,但你绝对是对的,你们其他人可能没听清,是n的平方。
So if N is not less than 2, that is I have two elements or more in which case there's definitely some sorting to be done.
因此如果N不小于2,也就是有2个或更多的元素,那当然是需要做排序的。
So this code is identical functionally nonswitch c to the last implementation we saw, nonswitch.c, but I'm just ever-more emphatically saying, "In case 1," that is when n equals 1 -- or when case 2 applies -- when n equals 2 or when n equals 3 do what?
所以这些代码到最后的实现上,功能是,完全相同的,但是我想要再次强调一下,“在case,1“,那是当n等于1时1,或者当case,2适用-,当n等于2或者当n等于3,它将做什么?
What is the probability distribution for x/n in that case?
在这样的情况下,x/n的概率分布是怎样的
Where n'th is somewhere between and 2 in this case.
而在这个例子中第n个元素,就是2和5之间的一个数。
I could still do the linear case, which is order n or I could say, look, take the list, let's sort it and then search it. But in that case we said well to sort it was going to take n log n time, assuming I can do that.
我仍然可以做O的线性搜索,或者也可以以这个列表为例,我们先将其进行排序,然后再进行查找,但是在这种情况下,要花费n,log,n的时间去对其进行排序。
I've got to test to see if I'm in the base case, and if I'm not, then I need to move a tower of size n minus 1, I need to move a tower of size 1, and I need to move a second-sorry about that a second tower of size n minus 1.
首先我看看我是不是在最基本的情况,如果不是的话,我得先做一个N-1个,圆盘的移动,移动一个圆盘,然后再做一次N-1个圆盘的移动。
I was just finding very tunnel vision-like, the smallest elements at that moment in time which means I don't know anything about the other elements other than they are not the smallest and so no matter what with Selection Sort I had to repeat this again and again and again and if you do out the math it's roughly N squared steps in the worst case as well.
我只有一个狭窄的视野,只知道某时刻的最小元素,就意味着我并不知道其他元素的任何情况,只知道它们不是最小的,所以不管怎样,在选择排序中,我就得一遍一遍地重复选择过程,在最坏情况下,大概需要N的平方次比较。
应用推荐