CS 441/539 Frequently Asked Questions (FAQs)


The following list of FAQs is provided for your convenience. If your question isn't answered below, don't despair! We want to be sure that you get an answer! To seek out the answer you need, you can: And, of course, you can always ask questions in class. Don't be shy.
We want to help you!

Homework 4

I'm having trouble understanding the problem for #4. Could you clarify it?

Let me give an example. Suppose you have an shop that customizes automobiles that offers the following services (or operations): install alarm, install sunroof, install child safety seat, install sound system, replace tires, re-paint. You have one machine which does each of the operations but it can only handle one car at a time. The input would consist of a set of customers, each of whom brings in a car with a list of operations (i.e. services) it would like. So an example input would be:
car 1: {re-paint, sunroof, sound system}
car 2: {sound system, replace tires, alarm, safety seat}
car 3: {sound system}
car 4: {safety seat, alarm}
For each car, you can do these operations in any order. But only one operation per car can be done at a time. So you could not re-paint car 1 at the same time a sound system is being installed. Also, remember that you could not be installing a sound system on car 2 and car 3 at the same time because they both require the same machine.

The goal is to schedule all the operations to finish up everything as soon as possible (so you can go home).

For problem 5, in the TSP definition are the weights restricted to be non-negative?

Yes. In TSP for all u,v, w(u,v) >= 0.


Homework 2

I've completed problem 1c but would like to confirm that I have done it correctly. What is the cost of the optimal layout for the given values of M?

When M=70 the optimal layout has cost is 109, when M=50 the optimal layout has cost 413, and when M=30 the optimal layout has cost 263. With this information you should be able to check that your layout itself is optimal.

For problem 1c, should we leave two spaces after each period?

The intention was the a period is just treated like any other character and thus you would just leave one space after a period. The above costs are under this assumption. If you add a special case for a period to put two spaces, that is fine. Just indicate so on your homework.


Homework 1

In problem 6, can I assume that all si and pi are integers?

No, the intention of the problem is that they can be arbitrary positive reals. However, as a first step go ahead and assume they are integers. If you correctly solve this (that is, you give a valid proof of correctness, give the most efficient algorithm possible and correctly analyze the time complexity) then you'll receive 9 out of the 10 possible points. There is a 2-3 line addition you can then add that will handle the case when the start times and processing times could be non-integral.

For Problem 5, is it okay if I have an ugly proof by cases with lots and lots of cases?

Please try to avoid doing this. It is not necessary.

For problem 2, can the songs be placed arbitrarily on the CDs as long as each CD contains the song in sorted order?

No. The first CD must contain song 1, song 2, .... song k. Then the second CD must contain song k+1, song k+2, .... and so on. So all you are doing is deciding when to end the current CD and start the next. The solution to this problem is not complex and neither is the proof. However, this is a good problem to be sure that you understand how to prove that a greedy algorithm is correct. If you feel that your solution is obviously correct and cannot prove it then you don't understand the mechanism provided in class to prove correctness and should come to our office hours and go over it with us.

For problem 4a, do we just have to describe the algorithm without proving it is correct/optimal?

That is not accurate. Read the information at the front of the homework. Whenever you are asked to give an algorithm you are expected to: (1) clearly describe the algorithm, (2) prove the algorithm outputs an optimal (and correct) solution, and (3) analyze the time complexity.

Return to the CS 441/539 Home Page