晨
晨晨
Unregistered / Unconfirmed
GUEST, unregistred user!
内容如下:
Mergesort
Two sublists, each already sorted, can be merged together to form one aggregate list that is also sorted. A simple and effective procedure fordo
ing this, called mergesort, begin
s by comparing pairs of elements – one from each sublist. The smallest element appended to a forted list and is replaced by the next element from its sublist. This continues until there are no more elements in one of the sublists. The remaining elements in the other sublist are then
appended to the sorted list, and the sort is complete.
This sounds good where there are two sorted sublists with which to begin
. If there are not, the problem is to decide how to get started. There are several possibilities.
One approach is to consider individual elements as sorted sublists of length one. Pairs of these sublists are merged to produce sorted lists of length two. Pairs of these lists are merged to produce sorted lists of length four. This process continues until only one sorted list remains.
Mergesort
Two sublists, each already sorted, can be merged together to form one aggregate list that is also sorted. A simple and effective procedure fordo
ing this, called mergesort, begin
s by comparing pairs of elements – one from each sublist. The smallest element appended to a forted list and is replaced by the next element from its sublist. This continues until there are no more elements in one of the sublists. The remaining elements in the other sublist are then
appended to the sorted list, and the sort is complete.
This sounds good where there are two sorted sublists with which to begin
. If there are not, the problem is to decide how to get started. There are several possibilities.
One approach is to consider individual elements as sorted sublists of length one. Pairs of these sublists are merged to produce sorted lists of length two. Pairs of these lists are merged to produce sorted lists of length four. This process continues until only one sorted list remains.