[Chicago] Not exactly a solution, but....
bradley.marts at gmail.com
Mon Jun 15 13:08:46 CEST 2015
In fact, the algorithm that you implemented in this code is insertion sort.
On each iteration you are "merging" a single element with a sorted list of
your previously merged elements. That is, you insert a single element into
your growing sorted list. This algorithm has time complexity O(n^2),
mergesort will have time complexity O(n log n).
On Mon, Jun 15, 2015 at 2:29 AM, Lewit, Douglas <d-lewit at neiu.edu> wrote:
> I sort of got my mergeSort program to work, but the problem is that the
> algorithm isn't really mergeSort at all! It uses merge, but my algorithm
> is iterative rather than recursive, so it's not really a mergeSort. It's a
> merge-something, but not true mergeSort. Oh well. Any suggestions?
> Chicago mailing list
> Chicago at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Chicago