*This preview shows
pages
1–2. Sign up to
view the full content.*

CSE5311 Design and Analysis of Algorithms
Exercise Problems 1
08/29/07
General Instructions about Exercise Problems
•
Problems and solutions will be discussed in Class. Solutions will not be available online.
•
You should attend class or meet with the Instructor/TA to discuss solutions.
•
It is to your benefit to try and solve the problems before the next class and participate in
the discussions.
1.
The list in
http://www.fec.gov/pages/elecvote.htm
gives the number of electoral votes for
each state for the Presidential election (the candidate receiving the majority of the votes
in a state collects all the electoral votes for that state.) There are altogether 538 electoral
votes. Determine whether it is (mathematically) possible for the election to end up in a
tie.
2.
The input is a set
S
containing n real numbers, and a real number
x
.
a.
Design an algorithm to determine whether there are two elements of
S
whose
sum is exactly
x
. The algorithm should run in O(
n
log
n
) time.
b.

This ** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
This is the end of the preview. Sign up
to
access the rest of the document.