Moving a stack of size 3, again, if I want to go over there, I need to make sure I can put the spare one over here before I move the bottom one, I can't cover up any of the smaller ones with the larger one, but I can get it there.
移动上面的三个圆盘的话,我在移动最底下的圆盘之前,同样要确保剩下的,是在另外一个柱子上,因为我不能把大的圆盘,放在小的上面。
Stack of size 4, again I'm going there, so I'm going to do this initially, no I'm not, I'm going to start again.
同样的,移动上面四个圆盘,同样也是。
OK, that's not so bad. Moving a stack of size 2 if I want to go there, I need to put this one temporarily over here so I can move the bottom one before I move it over.
好,并不那么难,移动上面两个圆盘的话2,我需要把最小的盘子,临时先放到多余的柱子上来,这样才能在把它移过来之前,把最底下的盘子放到目标柱子上。
Given the code up there, if I want to move a tower of size n, what do I have to do?
鉴于这里的代码,如果我想移动N个圆盘,我该怎么做?
I'm going to go there initially, so I can move this over here, so I can get the base part of that over there, I want to put that one there before I put this over here, finally I get to the point where I can move the bottom one over now I've got to be really careful to make sure that I don't cover up the bottom one in the wrong way before I get to the stage where I wish they were posts and there you go.
我要先把其他的放到多余的柱子上,然后把最底下的放到目标柱子上,我要在把除了最底下的圆盘,其他的圆盘挪过来之前,把最下面的圆盘放在这儿,因此我得出了最下面的盘子,应该如何摆放的结论,当我没得到其他盘子的正确摆放位置的时候,要很小心的确认没把错误的盘子,放在最下面的盘子上面。
Moving a disk of size 1.
移动面积为1的也就是最小的圆盘。
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个圆盘的移动。
If I want to move this stack here, I'm going to take a stack of size n minus 1 move it to the spare spot, now I can move the base disk over, and then I'm going to move that stack of size n minus 1 to there. That's literally what I did, OK?
如果我想移动这些圆盘,我先把从n-1个圆盘1,移动到多余的柱子上去,这样我就能把最底下的圆盘放到这儿了,然后再把从n-1个圆盘放到这儿来,这就是确切的我怎么做的对不对?
应用推荐