Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. public static void permutation(String str)
  2. {
  3. permutation(str, "");
  4. }
  5.  
  6. public static permutation(String str, String prefix)
  7. {
  8. if(str.length() == 0)
  9. System.out.println(prefix);
  10. else {
  11. String rem = str.substring(0, i) + str.substring(i + 1);
  12. permutation(rem, prefix + str.charAt(i));
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement