Re: Mergesort problem

2016-12-22 Thread Andrea D'Amore
I know a code review wasn't the main goal of you message but I feel it's worth mentioning two tips: On 22 December 2016 at 01:55, Deborah Swanson wrote: > ls = [] > with open('E:\\Coding projects\\Pycharm\\Moving\\New Listings.csv', > 'r') as infile: > raw = csv.reader(infile) >

RE: Mergesort problem

2016-12-21 Thread Deborah Swanson
> On Thu, Dec 22, 2016 at 11:55 AM, Deborah Swanson > wrote: > > The problem is that while mergeSort puts the list ls in > perfect order, > > which I can see by looking at result on merge's final return to > > mergeSort, and at the left and the right once bac

Re: Mergesort problem

2016-12-21 Thread Chris Angelico
On Thu, Dec 22, 2016 at 11:55 AM, Deborah Swanson wrote: > The problem is that while mergeSort puts the list ls in perfect order, > which I can see by looking at result on merge's final return to > mergeSort, and at the left and the right once back in mergeSort. Both > the left h

Mergesort problem

2016-12-21 Thread Deborah Swanson
rows = indata.__len__() for i in range(rows): ls.append(indata[i]) # sort: Description only, to make hyperelinks & find duplicates mergeSort(ls) # find & mark dups, make hyperlink if not dup for i in range(1, len(ls) - 1): if ls[i][0]

Re: MergeSort

2006-08-10 Thread Steven D'Aprano
On Wed, 09 Aug 2006 12:50:11 -0700, ben81 wrote: > Hi, > > the following code is adopted PseudoCode from Introduction to > Algorithms (Cormen et al). I'm assuming you are doing this as a learning exercise, because -- trust me on this -- nothing you write in pure Python code will come within coo

MergeSort

2006-08-09 Thread ben81
i +=1 else: A[k] = R[j] j +=1 def mergeSort(A,p,r): if p < r: q=(p+r)/2 mergeSort(A,p,q) mergeSort(A,q+1,r) merge(A,p,q,r) -- http://mail.python.org/mailman