Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Permutations Generator

 
P. Sagdeo
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I posted this in the bigginner forum, but since I saw similiar questions in the advanced forum, im posting it here too.
I need to create a permutations generator for a program that I am going to write. You would input how many numbers and it should output all the combinations (input 3 : output :
0,0,0
0,0,1
0,0,2
0,1,0
0,1,1
0,1,2
0,2,0
0,2,1
0,2,2
1,0,0,etc).
Anyone know of any good algorithms or something to get me started. I'm not sure where to begin.
Thanks,
Parth
 
don cline
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parth,
Try the following:


Good luck
Don
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic