Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes scramble --> help me to solve it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "scramble --> help me to solve it" Watch "scramble --> help me to solve it" New topic
Author

scramble --> help me to solve it

Manisekar Chinnasami
Greenhorn

Joined: Apr 07, 2007
Posts: 24
hi friends,

here is the problem ...

i need to get all the combinations of a word ...

in detail ... if the input string is "man", then the output should be ...
(all itz combinations)
man
mna
amn
anm
nma
nam

three is little bit easy , but i need it for word with minimum five letters ....


Manisekar
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Before starting to write code for this, think about the way you are going to solve this problem. How would you do this? You first need to have an idea of how it should work exactly, then you can start thinking about putting it down in code.

So, did you think about the problem yourself? Tell us how you think you could solve this, then we'll discuss if you're on the right way.

Also: Please check your private messages. You can see them by clicking "My Profile" at the top right of the page.
[ August 07, 2007: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Srikanth Basa
Ranch Hand

Joined: Jun 06, 2005
Posts: 241
Originally posted by Manisekar Chinnasami:

in detail ... if the input string is "man", then the output should be ...
(all itz combinations)
man
mna
amn
anm
nma
nam
....


Did you mean permutations or combinations ? The example you gave are permutations.

Apart from that there are standard algorithms for getting the permutation. Just try google.
[ August 07, 2007: Message edited by: Srikanth Basavaraju ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,

Welcome to JavaRanch!

Please don't post the same question to more than one forum; see our explanation here.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: scramble --> help me to solve it
 
Similar Threads
scamble --> help me to solve it
code to find out all combinations
Interesting non-programming problem
scamble --> help me to solve it
code to find out all combinations