CS 241 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!


Lab/C++/UNIX Related Questions:

How do I compile and run my procedures for Lab 1?
For the "B" part (including the version in which you also return the pair of points along with the distance), you are expected to put your divide-and-conquer algorithm in a file called "closest-pair.cc" You will also need to modify lab1.cc as indicated. A makefile is included with the provided code. Copy that into the directory with the rest of the code. Then just type "make". After successfull compilation and linking there will be a file called "lab1.out". Just type "lab1.out" to run it.

To do the timing, I just added all that is needed to the provided makefile. (Thus you may want to get a new copy of it from the course account.) For timing the divide-and-conquer routine you can use the provided "timing-ex.cc". The only change needed there is to change the call to closest_pair to have the argument structure required by your routine. (Also change the prototype at the top of the file.) Then type "make timing-ex". After successful compilation and linking it will create "timing-ex.out" that you can run.

For timing the naive routine you are to put the main routine in a file called time-naive.cc. You can copy timing-ex.cc (e.g. in UNIX type cp timing-ex.cc time-naive.cc) and then edit time-naive.cc. Notice that the sort routine is no longer needed and thus the calls to it (and the prototype at the top) should be removed. Place your implementation of the naive algorithm in "naive-closest-pair.cc". Then just type "make time-naive" to create "time-naive.out" which you can run.

When usig the provided code for Lab 1, why do I always get the same "random" set of points?
You can think of the random number generator as using some provided starting point (as defined by the "seed") and then generating a sequence of numbers in the range of 1 to 50000 that appear random. Of course, there is really an algorithm that generates these numbers. Thus if you use the same seed then you get the same set of numbers.

For the sake of debugging, ease of grading, and simplicty the seed used for the random number generator is always 0. Thus every time you run your program you get the same sequence from which the points are drawn. In lab 3, I will show how you can give a seed to the random number generator (or even seed it with the time for the system clock). If you are interested in how to do that I can tell you now. Also, notice that if you made a loop that generated say 3 point sets of the given size, then you would get 3 different point sets (albeit the same 3 each time you ran the program).

If you have further questions let me know.

Where can I do my lab work for CS 241?
Best Option: Go to the SPARC lab.

If you need help finding the labs the CEC home page has all the needed information. Check out "What's New?" and "Labs and Schedules"

2nd Best Option: Go to the Pentium PC lab. Log ontothe PC and choose wither "eXceed 4 rooted window" or "eXceed 4 local window from the "Sessions" folder. The rooted window will open a window just like an X-term, and the local window willmx X clients with PC windows --- Try them both. For more information on starting a unix session from a PC look at the PC section on the CEC Frequently Asked Questions page.

Last Option: Go to the MAC lab. Note that if you are going to use the debugger then you need to start a MacX session (which is not even currently available). Furthermore, the debugger differentiates between the three mouse buttons and the Macs just have a single mouse button. They are also slower than the other options.

NOTE: If you are having trouble copying files directly from the WEB (e.g. if you are on a MAC), you are best copying the provided files using the unix copy (cp) command as described on the Unix help page. Even if you are working in the SPARC or Xterm lab, I think you'll find it faster to use this option.

How do I get this MAC, IBM compatible, or UNIX station to do what I want it to do?
CEC's FAQ page on the three systems may have the answer you need. CEC also has consultants to answer general questions about computer use. However, please see the CS 241 teaching assistants for any questions that specifically relate to the course.


Homework Related Questions:

Correction for problem 4b: In the hint change floor(n/2) to ceiling(n/2)


Return to the CS 241 Home Page