943,724 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 1545
  • Java RSS
Mar 13th, 2009
0

Enumerating permutations

Expand Post »
HI all
Can anyone help me with this algorithm (I ned to write the code in java)......The java code would also be helpful

Describe a recursive algorithm for enumerating all permutations of the numbers {1,2,...,n}.

I'd appriciate it if somebody could explain this problem to me and give me some idea on how i can get started

Many Thanks
Reputation Points: 10
Solved Threads: 0
Light Poster
scream2ice is offline Offline
33 posts
since Mar 2008
Mar 13th, 2009
0

Re: Enumerating permutations

Have you understood the question yourself ? What do you mean by this:
Quote ...
Describe a recursive algorithm for enumerating all permutations of the numbers {1,2,...,n}
I don't think so, with the way you have copy-pasted the assignment-looking statement. If you haven't understood the question in the first place you cannot even begin with thinking how to answer it. So if you understand that, you yourself would gain a slight insight into what should be done to solve it.
Last edited by verruckt24; Mar 13th, 2009 at 1:35 pm.
Reputation Points: 485
Solved Threads: 89
Posting Shark
verruckt24 is offline Offline
944 posts
since Nov 2008
Mar 13th, 2009
0

Re: Enumerating permutations

Thanks a lot!
If i didn't know anything 'bout the question, i wouldn't have had posted it!

I know htat for n elements, there are n! possible permutations
And I think that the procedure should be something like this:
(to make it recursive) enumerate the permutatipons of n-1 in each
time that the recursive algorithm is called

It doesn't matter if you or no one else doesn't share any ideas
I've always come up with solutions of my own

oh...and for the copy-paste thing...I just wanted to make sure I state my problem clearly
thanks anyway
Reputation Points: 10
Solved Threads: 0
Light Poster
scream2ice is offline Offline
33 posts
since Mar 2008
Mar 13th, 2009
0

Re: Enumerating permutations

Firstly, there's no need to be so heated up for nothing you can save your energies for your solution finding activity. I wasn't trying to be rude or mean even. All I wanted to make sure was that you understand the problem well, which I did not think you had. Since your understanding of the problem is very important for your answer to be in the right direction otherwise you cannot expect that to happen.

And to answer some of your questions:
>If i didn't know anything 'bout the question, i wouldn't have had posted it!
You don't know thats the reason you have posted the question and posted
how you'd go about solving it. Don't try to show-off now that you knew so much.

And if you know so much :
>I know htat for n elements, there are n! possible permutations
>And I think that the procedure should be something like this:
>(to make it recursive) enumerate the permutatipons of n-1 in each
>time that the recursive algorithm is calle

Then why haven't you already started working on it with whatever you know of it ? Where's the code to show us your effort. All this knowledge yet no code to post means, quite straightforwardly, no effort put in till yet.

>It doesn't matter if you or no one else doesn't share any ideas
>I've always come up with solutions of my own

Hmm... Why would somebody like you then start a thread asking for help and solutions of others, in the first place.
Last edited by verruckt24; Mar 13th, 2009 at 2:53 pm.
Reputation Points: 485
Solved Threads: 89
Posting Shark
verruckt24 is offline Offline
944 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Installtion problem of MySql JDBC driver JConnector 5.0
Next Thread in Java Forum Timeline: Why doesn't this code delete a file? Help me troubleshoot





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC