And this is in contrast to Selection Sort where you're fishing again and again for the then smallest element.
这与选择排序是相反的,在选择排序中你需要一次又一次地,找出最小的元素。
So, the curious thing about recursion is that pretty much always can you implement this idea of doing the same thing again and again and again but with smaller bytes each time.
可见,递归算法中新奇的一点是,为了实现一个想法,你可以一遍又一遍地做相同的事情,但每次的规模都会有所减小。
Let's assume that you've won the lottery, and have serious money that you foolishly wish to invest in the stock market There are two basic strategies to choose from in investing.
让我们假设你赢了彩票,然后又一大笔钱,而你很傻的想要投资到股票中去,有两个投资策略,可以选择。
Imagine life where you never got used to anything, where suddenly somebody steps forward and waves their hand " and you'd go, "Woah," " and then they wave their hand again and you'd go, "Whoah," -- and you keep-- And there's the loud ticking of a clock and you say, " "Hmmm."
试想你在生活中无法习惯任何事情,要有人突然跳出来向你挥手,你肯定吓得惊叫,“哇“,然后他们再跟你挥手,你又惊叫“哇“,然后你就不停地-,或是在你听到响亮的钟摆声后很惊奇地说,“嗯“
And now here comes Eboo Patel telling me you don't have to add this to the already busy things I have to do.
现在Eboo,Patel又告诉我,你不必将此添加到,我必须做的已经很繁忙的事务中了。
But very soon will you find that if you're writing programs with lots and lots of functions, and some might call these, and these might call these, you can come up very soon with scenarios where you can not order them top to bottom, because everything is comingled, and there's a lot of cross talk among all of your functions.
但是不久后你们会发现你们写的程序中,有很多很多的函数,有的函数调用这些函数,这些函数又调用另外的函数,你不能用脚本,把它们从上到下排序,因为所有函数相互混合,在你的函数中也有很多交叉。
应用推荐