Permutation of a string in java using recursion

Tutorials Shared by the Internet Community

Advertisements


Synopsis

Find Permutation and Combination of a String , such type of questions can be asked in the written round of the major tech giants like Amazon.

Statistics

  • Total Hits - 11217

  • Total Votes - 19 votes

  • Vote Up - 11 votes

  • Vote Down - 8 votes

  • Domain - javahungry.blogspot.com

  • Category - JAVA/JAVA Misc

  • Submitted By - Java Hungry

  • Submitted on - 2014-04-02 06:19:56

Description

Let us understand first , what we want to achieve . We want to write a function which prints all possible orderings of the characters in the string, in other words, print all permutations that use all the characters from the original string.
For example , given a string "sky" , our function should return

Output : "ysk","ksy","yks","kys","syk" and "sky" ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements