Enumerating permutations

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2008
Posts: 31
Reputation: scream2ice is an unknown quantity at this point 
Solved Threads: 0
scream2ice scream2ice is offline Offline
Light Poster

Enumerating permutations

 
0
  #1
Mar 13th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 823
Reputation: verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough 
Solved Threads: 73
verruckt24's Avatar
verruckt24 verruckt24 is offline Offline
Practically a Posting Shark

Re: Enumerating permutations

 
0
  #2
Mar 13th, 2009
Have you understood the question yourself ? What do you mean by this:
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.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 31
Reputation: scream2ice is an unknown quantity at this point 
Solved Threads: 0
scream2ice scream2ice is offline Offline
Light Poster

Re: Enumerating permutations

 
0
  #3
Mar 13th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 823
Reputation: verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough verruckt24 is a jewel in the rough 
Solved Threads: 73
verruckt24's Avatar
verruckt24 verruckt24 is offline Offline
Practically a Posting Shark

Re: Enumerating permutations

 
0
  #4
Mar 13th, 2009
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.
Get up every morning and take a look at the Forbes' list of richest people. If your name doesn't appear.... GET TO WORK !!!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC