From 35f481ecbc21ae9c474ca36e8915920227d14b72 Mon Sep 17 00:00:00 2001 From: LIU Xinyu Date: Sat, 31 Oct 2015 12:47:36 +0800 Subject: [PATCH] [dc sort] editorial work --- sorting/dc-sort/dcsort-en.tex | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sorting/dc-sort/dcsort-en.tex b/sorting/dc-sort/dcsort-en.tex index c54c4edd76..b0cdedbc7c 100644 --- a/sorting/dc-sort/dcsort-en.tex +++ b/sorting/dc-sort/dcsort-en.tex @@ -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. @@ -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.