I am working on a project involving \"Dynamic Programming\" and am struck on this trivial thing, please help.
Suppose I take 4 as an input, I want to display somethi
here is the code is to find the combination
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rotateimage;
/**
*
* @author ANGEL
*/
public class BinaryPermutaion {
public static void main(String[] args) {
//object creation
BinaryPermutaion binaryDigit=new BinaryPermutaion();
//Recursive call of the function to print the binary string combinations
binaryDigit.printBinary("", 4);
}
/**
*
* @param soFar String to be printed
* @param iterations number of combinations
*/
public void printBinary(String soFar, int iterations) {
if(iterations == 0) {
System.out.println(soFar);
}
else {
printBinary(soFar + "0", iterations - 1);
printBinary(soFar + "1", iterations - 1);
}
}
}