Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -2,9 +2,9 @@ public static <T extends Comparable<? super T>> LinkedList<LinkedList<T>> BinPow
|
|||
LinkedList<T> A){
|
||||
LinkedList<LinkedList<T>> ans= new LinkedList<LinkedList<T>>();
|
||||
int ansSize = (int)Math.pow(2, A.size());
|
||||
for(Integer i= 0;i< ansSize;++i){
|
||||
String bin= Integer.toString(i, 2); //convert to binary
|
||||
while(bin.length() < A.size())bin = "0" + bin; //pad with 0's
|
||||
for(int i= 0;i< ansSize;++i){
|
||||
String bin= Integer.toBinaryString(i); //convert to binary
|
||||
while(bin.length() < A.size()) bin = "0" + bin; //pad with 0's
|
||||
LinkedList<T> thisComb = new LinkedList<T>(); //place to put one combination
|
||||
for(int j= 0;j< A.size();++j){
|
||||
if(bin.charAt(j) == '1')thisComb.add(A.get(j));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue