Began algorithm implementation.

This commit is contained in:
Jonathan Turner 2024-02-17 13:40:58 -05:00
parent 6cfc94869b
commit 7fa5f88499
2 changed files with 20 additions and 2 deletions

View File

@ -61,11 +61,25 @@ package Assignments.A2;
import java.util.ArrayList;
import java.util.List;
/**
* Generates, if possible, two equal subsets of a given set of elements that are equal to each other.
*
* @author Jonathan Turner
* @version Spring 2024
*/
public class Partition {
private int[] set;
private List<List<Integer>> subsets;
public void performAlgorithm() {
int totalSum = 0;
for (int i = 0; i < this.set.length; i++) {
totalSum += this.set[i];
}
}
/**
* Generates the list of subsets using Bit Shift Counting by iterating over all combinations of 1 to n.
* After shifting the counter, the current subset is created initialized and if 1 shifted by j is logically

View File

@ -23,7 +23,11 @@ public class FakeCoin extends Application {
* @postcondition a new FakeCoin application is created.
*/
public FakeCoin() {
super(new String[]{"The number of coins","Set FakeCoin Weight and Location","Find Fake Coin"});
super(new String[]{
"The number of coins",
"Set FakeCoin Weight and Location",
"Find Fake Coin"
});
this.setLocation = false;
}
@ -78,7 +82,7 @@ public class FakeCoin extends Application {
}
private void performAlgorithm() {
}
/**