Skip to content

Commit

Permalink
[dc sort] editorial work
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxinyu95 committed Oct 31, 2015
1 parent e55e478 commit 35f481e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sorting/dc-sort/dcsort-en.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,7 @@ \section{Nature merge sort}
span the non-decreasing sub sequence $[a, b)$ as long as possible, at the same time,
we span the sub sequence from right to left to span $[c, d)$ as long as possible as well.
The invariant for the working area is shown in the second row. All elements before
$f$ and after $r$ have already been sorted (Note that they may contain several
$f$ and after $r$ have already been processed (Note that they may contain several
ordered sub sequences). For the odd times (1, 3, 5, ...), we merge $[a, b)$ and $[c, d)$
from $f$ toword right; while for the even times (2, 4, 6, ...), we merge the two
sorted sub sequences after $r$ toward left.
Expand Down Expand Up @@ -2702,8 +2702,7 @@ \section{Bottom-up merge sort}
return zs + (xs if xs !=[] else ys)
\end{lstlisting}

The Python implementation exploit the fact that instead of starting next round of merging
after all pairs have been merged, we can combine these rounds of merging by consuming
The Python implementation combines multiple rounds of merging by consuming
the pair of lists on the head, and appending the merged result to the tail. This greatly simply
the logic of handling odd sub lists case as shown in the above pseudo code.

Expand Down

0 comments on commit 35f481e

Please sign in to comment.