src/Recursion_Course/recursion_print.java
public static void coinTossNoConsecutiveHead(int n, String ans, boolean wasHeadIncluded) {
		if (n == 0) {
			System.out.println(ans);
			return;
		}

		if (wasHeadIncluded) {
			coinTossNoConsecutiveHead(n - 1, ans + "T", false);
		} else {
			coinTossNoConsecutiveHead(n - 1, ans + "H", true);
			coinTossNoConsecutiveHead(n - 1, ans + "T", false);
		}
	}
// 	coin Toss with no consecutive heads
coin Toss with no consecutive heads
coin Toss with no consecutive heads
public static void coinTossNoConsecutiveHead(int n, String ans, boolean wasHeadIncluded) {
		if (n == 0) {
			System.out.println(ans);
			return;
		}
		if (wasHeadIncluded) {
			coinTossNoConsecutiveHead(n - 1, ans + "T", false);
		} else {
			coinTossNoConsecutiveHead(n - 1, ans + "H", true);
			coinTossNoConsecutiveHead(n - 1, ans + "T", false);
		}
	}
public static void coinTossNoConsecutiveHead ( int n , String ans , boolean wasHeadIncluded ) { if ( n == 0 ) { System . out . println ( ans ) ; return ; } if ( wasHeadIncluded ) { coinTossNoConsecutiveHead ( n - 1 , ans + "T" , false ) ; } else { coinTossNoConsecutiveHead ( n - 1 , ans + "H" , true ) ; coinTossNoConsecutiveHead ( n - 1 , ans + "T" , false ) ; } }
coin Toss with no consecutive heads
coin Toss with no consecutive heads