Programming Homework Help

Programming Homework Help. Election Simulator

Implement an Java ElectionSimulator class that can compute the minimum number of popular votes needed to win the Electoral College given the turnout during an election year.

1) ElectionSimulator(List<State> states)
Constructs a new ElectionSimulator for the given list of states.
2) Set<State> simulate()
Returns the set of states with the minimum number of popular votes needed to win the election.
See attached starter code
Design your recursive backtracking method to represent subproblems with two integer parameters: the current electoralVote threshold and the current index into the list of states. Then, solve the following optimization problem: “What is the set of states that minimizes the popular vote while satisfying the electoralVote threshold and using only states starting at the given index into the list of all states?”

Use the provided Arguments class to memoize (save) the solution to each subproblem by mapping the subproblem arguments to the set of states. If we’ve solved the subproblem before, then return the combination saved in the map.

  1. In the constructor, add a field to keep track of a new Map<Arguments, Set<State>>.
  2. In the recursive case, save the final solution to the current subproblem before returning the result.
  3. In the base case, if the solution to the current subproblem was saved earlier, return the saved solution.

Programming Homework Help

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"