CPSC 413: Assignment 2 Solutions
1. A biologist is looking at n samples of DNA. Finding the exact DNA
code for each sample is quite a slow process. However, all the biologist wants to know is whether at least half the samples come from the
same animal. He
Solution to Quiz 2
Fatemeh
8 October 2010
Let denote the n items with i1 , . . . , in . Each item ik , has three parameters assigned to it, (cik , pik , wik )
where cik denotes the time required for constructing the item, pik for painting and wik for wrap
Quiz 4 Solution
Fatemeh Keshavarz
1.(a). Consider T = 100.
And there are 3 items:
Profit
Weight
G1
100
70
G2
70
50
G3
60
40
The greedy solution takes G1 which does not give a maximum pr
CPSC 413 Fall 2010: Midterm
November 2nd, 2010
Name:
ID#:
Instructions:
No outside aids of any kind are allowed.
You have 1 hour and 15 minutes.
Do not turn this page until you are told to do so.
There are four questions on this exam, and each questio
Quiz 3 Solution
Fatemeh Keshavarz
1.(a).
The greedy algorithm would be sorting n items regarding their shipping time (ti) in
ascending order.
Utilizing algorithms such as Merge Sort will cause the algorithm to
CPSC 413: Assignment 1 Solutions
1. (a) Show that if f = O(g), then g = (f ).
If f = O(g), then there is some n0 and c > 0 such that for
all n n0 , f (n) cg(n). Dividing both sides by c then gives
g(n) 1 f (n) for all n0 n, so g = (f ).
c
(b) Recall that
EFFICIENT CERTIFICATION
Algorithm B is an efficient certifier for problem X if:
1) B is a polytime algo that takes 2 input string I (instance of X) and C (a certificate
2) B outputs yes or no
3) There is a polynomial p(n) such that for everything I: I X I