MCPcopy Create free account
hub / github.com/apna-college/Alpha / FindPermutations

Class FindPermutations

10_Backtracking/FindPermutations.java:1–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1public class FindPermutations {
2
3 public static void findPermutation(String str, String ans) {
4 if(str.length() == 0) {
5 System.out.println(ans);
6 return;
7 }
8
9 for(int i=0; i<str.length(); i++) {
10 char pickedChar = str.charAt(i);
11 String restStr = str.substring(0,i) + str.substring(i+1);
12 findPermutation(restStr, ans+pickedChar);
13 }
14 }
15
16 public static void main(String args[]) {
17 String str = "aa";
18 findPermutation(str, "");
19 }
20}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…