File tree Expand file tree Collapse file tree 2 files changed +36
-9
lines changed
src/main/java/com/rampatra/permutations Expand file tree Collapse file tree 2 files changed +36
-9
lines changed Original file line number Diff line number Diff line change 11package com .rampatra .permutations ;
22
33/**
4- * Created by IntelliJ IDEA.
4+ * Prints all the permutations of a string by using the characters in the
5+ * input only once.
56 *
6- * @author: ramswaroop
7- * @date: 9/24/15
8- * @time: 2:27 PM
9- * @see: http://www.ericleschinski.com/c/java_permutations_recursion/
10- * @see: http://introcs.cs.princeton.edu/java/23recursion/Permutations.java.html
11- * @see: me.ramswaroop.strings.StringPermutationCount for a modification of this problem
7+ * @author ramswaroop
8+ * @link http://www.ericleschinski.com/c/java_permutations_recursion/
9+ * @link http://introcs.cs.princeton.edu/java/23recursion/Permutations.java.html
10+ * @link me.ramswaroop.strings.StringPermutationCount for a modification of this problem
11+ * @since 9/24/15
1212 */
1313public class StringPermutations {
1414
1515 /**
1616 * Generates and prints all possible permutations (in order)
1717 * of string {@param s}.
1818 *
19- * @param prefix
20- * @param s
19+ * @param prefix empty string, needed for the recursive method
20+ * @param s input string with no repeated characters
2121 */
2222 public static void printAllPermutations (String prefix , String s ) {
2323 int len = s .length ();
Original file line number Diff line number Diff line change 1+ package com .rampatra .permutations ;
2+
3+ /**
4+ * A slight variation of {@link StringPermutations} where the input may
5+ * contain repeated characters.
6+ *
7+ * @author rampatra
8+ * @since 16/11/2018
9+ */
10+ public class StringPermutationsWithDuplicates {
11+
12+ /**
13+ * Generates and prints all possible permutations (in order)
14+ * of string {@param s}.
15+ *
16+ * @param prefix empty string, needed for the recursive method
17+ * @param s input string with repeated characters
18+ */
19+ public static void printAllPermutations (String prefix , String s ) {
20+ // TODO
21+ }
22+
23+ public static void main (String [] args ) {
24+ printAllPermutations ("" , "aba" );
25+ }
26+ }
27+
You can’t perform that action at this time.
0 commit comments