• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

permutation

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in java language is there any method to find permutation or combination for given string?
 
Maneesh Godbole
Saloon Keeper
Posts: 11072
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no only for normal string .like names.
ex jhon,son.....
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried what Maneesh suggested ?
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic