aspose file tools*
The moose likes Beginning Java and the fly likes combinations and permutations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "combinations and permutations" Watch "combinations and permutations" New topic
Author

combinations and permutations

chandrasekharareddy palugulla
Greenhorn

Joined: Feb 09, 2007
Posts: 3
I have a two dimentional array
like String twoDimentions ={
{ "A", "B", "C", "D", "E", "F" },
{ "A", "B", "C", "D", "E" },
{ "A", "B", "C", "D" },
{ "A", "B", "C" },
{ "A", "B","C","D" }
};
twoDimentional arry length will be dynamically changing.
two dimentional array having single dimentional arrays.
length of single dimentional array dynamically changing.
now i want comination of String like "AAAAA","AAAAB","AAAAC","AAAAD","AAABA","AAABB","AAABC","AAABD","AAACA","AAACB","AAACC","AAACD".................."FEDCD".
here "AAAAA" means each character from different arrays,
each element coming from different different arrays,
total no of strings (combinations) should be 1st array * 2nd array * 3rd array........
for above example it should be having 6*5*4*3*4 = 1440
each string length should be equals to size of twodimentional array. each string length should not less or greather than length of two dimentional array.

please give answer..........
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38768
    
  23
We don't simply give such answers. Please show us what you have achieved so far; pseudo-code might be the best thing to show us.

Then we shall be pleased to help with any problems you might encounter.
Piet Verdriet
Ranch Hand

Joined: Feb 25, 2006
Posts: 266
JosAH gave you some pretty good hints here:
http://forums.sun.com/thread.jspa?threadID=5385583
The people over there also encouraged you to post your own efforts instead of asking for a spoon-fed-solution, which you didn't do.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

chandrasekharareddy,

Please Be Forthright When Cross Posting To Other Sites.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38768
    
  23
Agree. Thank you for noticing, Piet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: combinations and permutations