• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

combinations and permutations

 
chandrasekharareddy palugulla
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 266
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
chandrasekharareddy,

Please Be Forthright When Cross Posting To Other Sites.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree. Thank you for noticing, Piet.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic