comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Desperatly trying to implement an mergesort algorithm
Date: Fri, 4 Nov 2005 19:33:53 -0800
Date: 2005-11-04T19:33:53-08:00	[thread overview]
Message-ID: <KNidnaP7LZyKtfHeRVn-gA@comcast.com> (raw)
In-Reply-To: 1131121827.249591.288510@g14g2000cwa.googlegroups.com

<ejijott@gmail.com> wrote in message 
news:1131121827.249591.288510@g14g2000cwa.googlegroups.com...
> Does the partitioning look proper? With me using A'first and A'last?
>
> mergesort(A(A'first .. middle));
> mergesort(A(middle+1 .. A'last));
>

The partitioning looks right to me.

Now a few questions:
  What is left_list for?  (looks like it could be deleted)
  What is right_list for? (looks like it could be deleted)

  In the while loop that does the merging, the smallest value of elements i 
and j are added sortarr, until one of the halves of the sublists is 
exhausted.  What happens to the remaining elements?

That's not your biggest problem:

Hint: If you change the procedure to

procedure Mergesort(A: List) ...

Your code will still compile.

Steve
(The Duck)





  reply	other threads:[~2005-11-05  3:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04 16:02 Desperatly trying to implement an mergesort algorithm ejijott
2005-11-04 16:22 ` Samuel Tardieu
2005-11-04 16:30   ` ejijott
2005-11-05  3:33     ` Steve [this message]
2005-11-04 18:48 ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox