comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: permutation of strings
Date: Mon, 6 Oct 2014 22:38:25 -0700 (PDT)
Date: 2014-10-06T22:38:25-07:00	[thread overview]
Message-ID: <460f8eef-a6b8-4774-ac30-edba9f366676@googlegroups.com> (raw)
In-Reply-To: <e8fd54ae-a39c-469c-91d6-310893d1e420@googlegroups.com>

On Tuesday, October 7, 2014 7:23:53 AM UTC+2, Stribor40 wrote:
> I have created this code using some online tutorials and some examples that i tried to learn... i havent been able to find whats wrong with my code....i am guessing what my variable j is somehow getting reset during the recursive calls...
> 
> i have been trying to retrace recursive calls by writing each call on the on the paper but i get lost trying to track it down......
> 
> my code spits out numbers...123 123 123 123 123 123 instead of 123 132 213 231 321 312 so i was hoping if someone can take a look and suggest how to fix this....
> 
> i pasted the code here it is ready to be compiled and there are no errors when it is compiled....http://pastebin.com/rDF46RbR

At the moment I do not have a compiler at hand (I'm having breakfast :-), but I see at least one strange thing in your code: in the loop "for Index ...." I would expect calls to "change(s, i, Index)" rather than "change(s, i, j)".  With the latter there is no difference between different iterations and this could give rise to your error.

By the way, there is no need to have j declared "in out" in Change, since j is not changed. Moreover, I suspect that with the "in out" specification the compiler will complain, since you cannot change a loop index.

  reply	other threads:[~2014-10-07  5:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-07  5:23 permutation of strings Stribor40
2014-10-07  5:38 ` mockturtle [this message]
2014-10-07 11:22   ` Brian Drummond
replies disabled

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