Subsequence that Sums Up to Half the Total Sum

In summary, the conversation discussed the possibility of a tie in presidential elections and the search for an efficient algorithm to determine if there is a sub-sequence that adds up to half of the total votes. The New York Times' FiveThirtyEight blog mentioned a scenario in which there could be a tie with a 1.3% chance of occurring. The conversation also suggested looking into the partition problem and using dynamic programming to solve it.
  • #1
TCAZN
1
0
Hi all,

I was just looking at the U.S. electoral map, and I was wondering if there could possibly be a tie in presidential elections (the answer is probably no). I tried to think of an efficient algorithm to answer this question, but due to my limited intelligence and imagination, all I could think of is the brute force method. I guess in this particular problem, efficiency probably does not matter since the number of states definitely doesn't follow any kind of Moore's Law.

Anyways, I was just wondering if anyone knows an efficient algorithm for the following problem:

Given a finite sequence $$a_1, a_2, \dots a_n,$$ determine whether there is a sub-sequence $$a_{i_1}, a_{i_2}, \dots a_{i_k}$$ such that $$\sum_{j=1}^{k} a_{i_j} = \frac{1}{2} \sum_{j=1}^{n}a_j$$.
 
Technology news on Phys.org
  • #2
Google for "knapsack problem"

In this case, there are 2^51 combinations of states and only 500 or so possible values,
so it's almost certain some combination has half the votes. (unless the total number of votes is odd)
Just select states at random with a coin flip and you'll get it within a few thousand tries.
 
  • #3
According to the New York Times’ FiveThirtyEight blog, one possible scenario to give each candidate 269 electoral votes would be if President Obama wins the following:

Washington, D.C.
California
Oregon
Washington
Hawaii
New Mexico
Minnesota
Michigan
Illinois
Wisconsin
Ohio
Pennsylvania
Maryland
Delaware
New Jersey
New York
Connecticut
Massachusetts
Rhode Island
New Hampshire
Vermont
Maine

Under that scenario, Gov. Romney would win all other states, including battleground states like Florida, Iowa, Virginia, Colorado and Nevada. The FiveThirtyEight blog pegs the chance of a tie occurring at 1.3%.

Source: http://foxnewsinsider.com/2012/10/24/what-happens-if-the-presidential-election-ends-in-a-tie/
 
Last edited by a moderator:
  • #4
Look up the partition problem. It seems that it can be solved with dynamic programming.
 
  • #5


Hello,

Thank you for bringing up this interesting problem and for sharing your thoughts on it. I can understand your concern about finding an efficient algorithm for this problem. While I cannot provide a specific algorithm, I can offer some insights and suggestions that may help in finding a solution.

Firstly, let's clarify that a tie in a presidential election is possible, although it is rare. In the event of a tie, the election is decided by the House of Representatives. Now, coming to the problem at hand, finding a subsequence that sums up to half the total sum is essentially a subset sum problem, which is a well-known problem in computer science with various known solutions.

One approach to solving this problem is by using dynamic programming, where we can keep track of the partial sums and check if any of them is equal to half the total sum. This approach has a time complexity of O(n*sum), where n is the length of the sequence and sum is the total sum. Another approach is to use a backtracking algorithm, which has a time complexity of O(2^n). However, for a finite sequence, both of these algorithms should work efficiently.

In terms of the states' numbers, as you mentioned, they do not follow Moore's Law, but we can still optimize the algorithm by considering the fact that the total sum of the numbers in the sequence will always be even (as half of it needs to be an integer). This knowledge can help us in pruning the search space and making the algorithm more efficient.

In conclusion, while there may not be a direct and easy solution to this problem, there are known algorithms that can efficiently solve it. I hope this helps in your further exploration of this problem. Thank you for your inquiry and happy problem-solving!
 

What is a subsequence that sums up to half the total sum?

A subsequence is a sequence of elements from a given sequence, with the elements appearing in the same order as they do in the given sequence. A subsequence that sums up to half the total sum means that the sum of the elements in the subsequence is equal to half of the sum of all the elements in the given sequence.

How do you find a subsequence that sums up to half the total sum?

There are various algorithms that can be used to find a subsequence that sums up to half the total sum. One approach is to use a dynamic programming approach, where we keep track of the sum of all possible subsequences and check if any of them add up to half the total sum. Another approach is to use a sliding window technique, where we move a window across the sequence and check if the sum of the elements inside the window is equal to half the total sum.

Is there always a subsequence that sums up to half the total sum?

No, there may not always be a subsequence that sums up to half the total sum. If the total sum of the given sequence is an odd number, it is not possible to find a subsequence that sums up to half the total sum.

Can a subsequence that sums up to half the total sum have duplicate elements?

Yes, a subsequence that sums up to half the total sum can have duplicate elements. For example, in the sequence [2, 5, 3, 7, 4, 2], the subsequence [5, 4, 2] sums up to half the total sum (10), and it contains the duplicate element 2.

How can finding a subsequence that sums up to half the total sum be applied in real-life situations?

This problem can be applied in various real-life situations, such as finding a subset of items in a store that adds up to half the total cost, finding a combination of investments that adds up to half the total portfolio value, or finding a sequence of days in a month where the average temperature is half of the total average temperature for the month.

Similar threads

Replies
4
Views
774
Replies
2
Views
1K
Replies
2
Views
144
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Programming and Computer Science
Replies
27
Views
6K
  • Programming and Computer Science
Replies
13
Views
3K
  • Math Proof Training and Practice
Replies
8
Views
1K
  • Programming and Computer Science
Replies
14
Views
3K
Back
Top