wood burning stoves 2.0*
The moose likes Java in General and the fly likes permutation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "permutation" Watch "permutation" New topic
Author

permutation

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1160
in java language is there any method to find permutation or combination for given string?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10426
    
    8

Permutations and combinations for what in a string? Character sequence? Something like and->dna->nad->nda...?

If yes, you can probably piggy back on Collections#shuffle()


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1160
no only for normal string .like names.
ex jhon,son.....
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Have you tried what Maneesh suggested ?


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1160
my problem is ,i need to
Write a program to display permutations & combination of one string
so i need to know whether there is a any method to get all permutation for given String
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

aruna sameera wrote:my problem is ,i need to
Write a program to display permutations & combination of one string

This looks like a Homework problem, so better try to do it yourself. Here are some hints about How to proceed.

1. S0.....Sn, is a string to permutations
2. Get all the possible permutations for S0, then combining with S1 up to combining Sn

eg
ABC

1. A -> A
2. AB -> AB , BA
3. ABC -> A BC, B A C, BC A
 
GeeCON Prague 2014
 
subject: permutation