File tree 2 files changed +36
-9
lines changed
src/main/java/com/rampatra/permutations
2 files changed +36
-9
lines changed Original file line number Diff line number Diff line change 1
1
package com .rampatra .permutations ;
2
2
3
3
/**
4
- * Created by IntelliJ IDEA.
4
+ * Prints all the permutations of a string by using the characters in the
5
+ * input only once.
5
6
*
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
12
12
*/
13
13
public class StringPermutations {
14
14
15
15
/**
16
16
* Generates and prints all possible permutations (in order)
17
17
* of string {@param s}.
18
18
*
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
21
21
*/
22
22
public static void printAllPermutations (String prefix , String s ) {
23
23
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