ONCAMPUS EXAM
Q1.
Give an algorithm (as efficient as possible) to find if you can partition a set of
n
distinct
integers into two sets of equal sum. Give its complexity in terms of
n
and
S
(
S
is the sum
of the
n
integers).
Q2.
In ancient ages, there used to be no currency. People used to trade using
barter
. For
example, an apple may be exchanged with 1.5 sack of rice; one sack of rice may be
exchanged with 2.5 bags of potatoes etc. You have a directed graph G = (V,E) where the
nodes represent the items used in barter (1 apple, 1 sack of rice, 1 bag of potatoes etc.)
and an edge between the two nodes represents the exchange rate between the two items
(like, the weight of the edge from 1 apple to 1 sack of rice would be 1.5). You can
assume that the barter rates are consistent between
any two
items (like, if the edge from 1
sack of rice to 1 bag of potato has the weight 2.5, the reverse edge would have a weight
of 0.4).
You are a businessman and you want to make profit just by exchanging goods. Find if it
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 UNGOR
 Algorithms, Graph Theory, source shortest path, minimumcost path

Click to edit the document details