Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Permutations

 
Lin Shen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. I need to write a program which can do permutations. E.g
cat
cta
act
atc
tca
tac
will be printed out if the imput cat is given on the command line. Similarly, 24 different combinations should be printed out if a String with 4 characters are given.
The code I written is shown below:

The result I got missed first few characters for each combination. Could anyone help me to fix it? If you think my idea is totally wrong, please give me some hints, please.
 
Herb Schildt
Author
Ranch Hand
Posts: 253
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried compiling the code that you posted but got a number of compiler errors. Could repost a clean copy of your program?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12125
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I couldn't get this code to compile without a few changes. even then, it wouldn't run - getting a "java.lang.NoClassDefFoundError: Permutations" error.
are you sure the code you posted was correct?
sorry for the duplicate post, i was typing mine when Herb posted his.
[ October 08, 2003: Message edited by: fred rosenberger ]
 
Lin Shen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Lin Shen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry. The copy/paste does not work. I therefore typed my code by hand. Here is the code again.
 
Lin Shen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have solved this problem!!! I am so happy now.
 
Herb Schildt
Author
Ranch Hand
Posts: 253
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am happy that your problem is fixed!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic