src/Recursion_Course/recursion_get.java
public static ArrayList<String> permutation(String str) {
		if (str.length() == 0) {
			ArrayList<String> br = new ArrayList<String>();
			br.add("");
			return br;
		}

		char ch = str.charAt(0);
		String ros = str.substring(1);

		ArrayList<String> rr = permutation(ros);

		ArrayList<String> mr = new ArrayList<String>();

		for (String val : rr) {
			for (int i = 0; i <= val.length(); i++) {
				mr.add(val.substring(0, i) + ch + val.substring(i));
			}
		}

		return mr;
	}
//	Function to print the permutation of the string.
Function to print the permutation of the string.
Function to print the permutation of the string .
public static ArrayList<String> permutation(String str) {
		if (str.length() == 0) {
			ArrayList<String> br = new ArrayList<String>();
			br.add("");
			return br;
		}
		char ch = str.charAt(0);
		String ros = str.substring(1);
		ArrayList<String> rr = permutation(ros);
		ArrayList<String> mr = new ArrayList<String>();
		for (String val : rr) {
			for (int i = 0; i <= val.length(); i++) {
				mr.add(val.substring(0, i) + ch + val.substring(i));
			}
		}
		return mr;
	}
public static ArrayList < String > permutation ( String str ) { if ( str . length ( ) == 0 ) { ArrayList < String > br = new ArrayList < String > ( ) ; br . add ( "" ) ; return br ; } char ch = str . charAt ( 0 ) ; String ros = str . substring ( 1 ) ; ArrayList < String > rr = permutation ( ros ) ; ArrayList < String > mr = new ArrayList < String > ( ) ; for ( String val : rr ) { for ( int i = 0 ; i <= val . length ( ) ; i ++ ) { mr . add ( val . substring ( 0 , i ) + ch + val . substring ( i ) ) ; } } return mr ; }
Function to print the permutation of the string.
Function to print the permutation of the string .