CIS 435 DL, Spring 2004
Midterm Exam
Prof. J. Calvin
Print Name (last name rst): This exam consists of 7 pages, numbered 1 through 7. Before starting to work, make sure that you have all 7 pages. There are six problems, each counting 20 points. Write all
CIS 435, Spring 2002, Jim Calvin Homework #10 Solutions
16.2-3 Suppose we have n items with weights w1 w2 wn and values v1 v2 vn . The optimal algorithm is: take items 1, 2, . . . , k where k is the first integer such that w1 + w2 + + wk+1 > L. To show th
CIS 435, Fall 2000, Jim Calvin Homework #9 Solutions
17.2-3. Suppose we have n items with weights w1 w2 wn and values v1 v2 vn . The optimal algorithm is: take items 1, 2, . . . , k where k is the first integer such that w1 + w2 + + wk+1 > L. To show that
CIS 435, Spring 1999, Jim Calvin Homework 7 and 8 Solutions
so we have n activities and so 2n events. Sort the events by increasing time if on activity ends at the same time as another begins, the ending time comes rst. Now go through the event list in or
CIS 435, Spring 2002
First Midterm Exam
Prof. J. Calvin
Print Name (last name first): Do not open this exam until instructed to do so. The exam consists of 5 pages, numbered 1 through 5. Before starting to work, make sure that you have all 5 pages. There
CIS 435, Fall 2001, Jim Calvin Homework #4 Solutions
6.3-3 (Solution in notes.) 6.4-3 If all the elements are equal, heapsort takes (n) time. Assume that the elements are distinct. Then if the array is in decreasing order, we save the trouble of forming t
CIS 435, Fall 2001
First Midterm Exam
Prof. Jim Calvin
Print Name (last name first):
Do not open this exam until instructed to do so. The exam consists of 6 pages, numbered 1 through 6. Before starting to work, make sure that you have all 6 pages. There a
So far in the course we have seen many problems that have polynomialtime solutions that is, on a problem instance of size n, the running time T (n) = O(n ) for some k, with k typically small. For example, we discussed sorting algorithms with T (n) = O(n l
CIS 435, Spring 1999, Jim Calvin Induction
The principle of induction is simple, applying it takes a bit of practice. This note is to give you some practice. Recall the principle: If a property of the non-negative integers holds for 0, and if it holds for
CIS 435, Spring 2000, Jim Calvin Induction
The principle of induction is simple, applying it takes a bit of practice. This note is to give you some practice. Recall the principle: If a property of the non-negative integers holds for 0, and if it holds for
CIS 435 DL, Fall 2001, Jim Calvin Homework #12 Solutions 34.1-4. The dynamic programming solution ran in time O(nW ), which at first glance appears to be polynomial time. However, it requires lg(W ) bits to store W , and so the running time is O(n 2lg(W )