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个圆盘的移动。
Once I have it sorted I can search it in log n time, but that's still isn't as good as just doing n. And this led to this idea of amortization, which is I need to not only factor in the cost, but how am I going to use it?
一旦对其完成排序,就可以在log,n的时间内对其完成搜索,但是这样做仍然不如n的复杂度,这样做引出了耗时分摊的想法,这时不仅需要考虑耗时的因素?
应用推荐