That got split in half, and that got split in half until I got to a list of one.
在那里被分成两半,然后在那里被分两半,直到得到长度为一的列表。
I hope you can see this because I'm going to try and simulate what a merge sort does. I've got eight things I want to sort here, and those initially start out here at top level.
我希望你们认真看,因为我要尝试着模拟出归并排序的操作过程,这里我有八个元素进行排序,第一步是将它们分成两半,对吗?
Merge sort takes this idea of divide and conquer, and it does the following: it says let's divide the list in half.
归并排序以如下的步骤使用了分治思想:,把列表分成两半:,下面就是分治。
There's the divide and conquer.
我们继续将每个列表分成两半。
Ah ha, split it in half.
啊哈,把它分成两半。
At each stage, no matter which branch, here or here, I take, I'm cutting down the length of the list that I'm searching in half. All right?
选的是这里还是那里,我总是把列表分成两半,对吧?,所以如果我处理一个长度为n的列表?
应用推荐