This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "static void main" must be defined in a public class. | |
public class Main { | |
public static void main(String[] args) { | |
listItem(new String[] {"A","B","C","D","E","F"}); | |
} | |
static public void listItem(String[] names) { | |
int n = names.length; | |
for (int c=0;c<Math.pow(2,n);c++) { | |
System.out.print("{"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "static void main" must be defined in a public class. | |
public class Knapsack { | |
private String[] name; | |
private int[] weight; | |
private int[] value; | |
private int[][] m; | |
private int capacity; | |
public static void main(String[] args) { |
OlderNewer