CS 600 Final Exam
December 14, 1998



1. In the binary search, the key being searched for, say x, is compared with the key at the middle of the list at each iteration. If they are equal, then x is found. If x is larger, then the search goes to the upper half of the list and the next iteration begins. If x is smaller then it goes to the lower half. This process is continued until either x is found or no more keys to be compared to xexists (that is x is not in the list).



Consider the following search (let us call it a ternary search): In each iteration of this search x is compared with two keys in the list L; one at index n/3, denote it by L[n/3], and one at index 2n/3, denote it by L[2n/3], where n is the number of keys in the list. If x is equal to one of them, then x is found.
If x is less than L[n/3], then the search goes to the bottom 1/3 of L (call it BOTTOM), else if x is greater than L[2n/3], then the search goes to the top 1/3 of L (call it TOP), else the search goes to the middle 1/3 of L (call it MIDDLE).
This is repeated until x is found in L or found not to be in L.



Below assume that x is always in the list, that x can be at any index with equal probability, and that n = 2*3k - 1 for simplicity.



(a) Find the worst case time of the ternary search. [10 points]
(b) Let us try to compute the average time for the ternary search.
An upper bound is found in (a) above. Let us find a lower bound.
For that, assume that in each iteration one operation is sufficient to find where x is (i.e. x is in BOTTOM, MIDDLE, or TOP, or at n/3 or 2n/3). (This is, of course, not possible with ordinary computers but let us assume that we have hardware to do that .)
Find the average time for the ternary search in this case. You may use the following formulas if necessary:
$\Sigma_{i=1}^{m} i 2^{i} = (m - 1) * 2^{m + 1} + 2$,
$\Sigma_{i=1}^{m} 3^{i} = (3^{m + 1} - 3)/2 $,
$\Sigma_{i=1}^{m} i 3^{i-1} = ((2m - 1) * 3^{m} + 1)/4$,
$\Sigma_{i=1}^{m} \lg i = O(m\lg m)$. [10 points]

2. Suppose that we have a set of n jobs with processing time of pi, i = 1, .., n, a deadline D for all the jobs, and k identical processors. Suppose also that each processor can process one job at a time, that each job can be processed by at most one processor, and that a job can not be split. Now consider the question of whether or not there is a schedule, that is the assignment of jobs to processors, such that all the jobs can be finished before the deadline D.
Prove that this problem is NP-Complete. You may use "graph coloring", "knapsack", or "bin packing" as your known NP-Complete problem.
[20 points]



3. A company is planning to produce and market three different products 1, 2 and 3. The preliminary estimates of their potential profitability are as follows.



For the first 15 units produced of product 1, the unit profit would be $30. The unit profit would be $4 for any additional units. For the first 20 units of product 2, the unit profit is estimated at $25. It is going to be $11 for the next 25 units, and $9 for any additional units. For the first 10 units of product 3, the unit profit would be $55. It would be $32 for each of the next 10 units and $10 for any additional units.



Also altogether at most 60 units can be marketed. To produce parts for one unit of product 1, 3 people are needed, and for one unit of product 2, 2 people are needed. Further at most 200 people can be used to produce parts for products 1 and 2. In addition products 1 and 3 require 1 and 2 people for assembling one unit, respectively, and at most 70 people are available for assembling.



The management wants to know how much of each product to be produced to maximize the total profit. Use the separable programming technique to formulate this problem as a linear programming problem. [20 points]

4. Acme Mutual is recommending investing in the following three industries for its customers:
Environmental, Health, and Information. There are also three risk areas to be considered: Low Risk, Moderate Risk and High Risk.
It is recommending its customers the following strategy:



a) At least $13K, $34K and $22K be invested in Environmental, Health and Information, respectively, where K stands for 1,000;
b) At least $25K, $22K and $19K be invested in Low Risk, Moderate Risk and High Risk areas, respectively; and
c) Minimum and maximum amount allocated to each risk area in each industry group satisfy the following limits (in thousand dollars):



  Environmental Health Information
Low Risk (8,10) (11,12) (7,12)
Moderate Risk (6,8) (11,12) (8,12)
High Risk (2,4) (10,12) (5,7)



where the first number in each parenthesis is the lower limit and the second the upper limit.



Formulate this problem as one of the flow problems and explain how it can be solved. You DO NOT have to solve it. [20 points]



5. Five jobs need to be done on a certain machine. However the setup time for each job depends on which job immediately preceded it, as shown by the following table.



  Setup Time (minutes)
Immediately Preceding Job Job
  1 2 3 4 5
None 8 10 16 18 8
1 - 14 24 20 18
2 12 - 20 28 22
3 20 22 - 24 20
4 14 16 30 - 14
5 24 18 16 32 -



The objective is to schedule the sequence of jobs that minimizes the sum of the resulting setup times.

Solve this problem using a branch-and-bound algorithm. Explain how you branch, how you bound, and how you prune branches. [20 points]


 

S. Toida
1999-08-31