This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes combination of strings Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

combination of strings

N Vinod
Greenhorn

Joined: May 13, 2002
Posts: 2
If I have 5 elements ABCDE,
then i should get all possible 3 element combinations like :
ACE
BCD
CDE
ACE
ACD
ADE
BDE
Instead of 5/3 elements i should be able to work with say 50/10 elements too, so the coding needs to be general for any number of elements.
At present i am able to get ABC, BCD,CDE.
So i am unable to get all the combinations.
thanks for trying in advance,
Vinod
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch!
Steve Deadsea's ideas shared in a recent conversation on generating all possible combinations would probably help you out quite a bit.
Good Luck.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
This conversation continues here...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: combination of strings
 
Similar Threads
vector elements asssignment to variables for storing to db
Can't i create a non-static local class instance using the instance of the outer clas
Reading XML Documents Using DOM...
Reading properties file in spring mvc 3.0
Challenging permutation - combination of strings