Exam3 - ON-CAMPUS EXAM Q1. Give an algorithm (as efficient...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ON-CAMPUS 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
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Exam3 - ON-CAMPUS EXAM Q1. Give an algorithm (as efficient...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online