Reminder

  • If you haven't done so already, please fill out the COS 126 student survey. It will only take a minute. Otherwise your name will not get entered in our database, and you will not receive a grade in this course.

  • Goals

  • If you're new to programming, the goal of this week's assignment is to make sure that you can:

  • Read data from standard input and write to standard output - scanf() and printf().

  • Use loops - for and while.

  • Use branches - if and else.
  • You needn't worry much about why Floyd's method works; instead concentrate your efforts on implementing the algorithm.

  • If you have lots of previous programming experience, your goal this week is to:

  • Introduce you to the C language, if you have learned another.

  • Understand why Floyd's method works, and appreciate its elegance. Think on your own about other ways to compute the cycle length, and consider the amount of time and memory used by these methods.

  • Testing

  • Here's a link to some hints on getting started with the assignment.

  • To test your code, run your program with the various parameters used in the assignment or you can use the values in these text files. Also, you should run your program on different parameters of your own choosing.

  • If you're on the arizona system you can check your work by comparing your results with our reference programs. Type "trace126" or "cycle126" to run our version of the two programs. We'll look into getting executable versions of these programs for Windows and OS X operating systems.

  • Submission

  • Submit your files via courseinfo.cs.princeton.edu. Email or hardcopy submissions are not acceptable.

  • The assignment (and submission form) specifies exactly which names to use: trace.c, cycle.c, and readme.txt. These names are case-sensitive. Do not deviate from these instructions in any way. We process your submissions using an automated script, and you will not receive any credit if you don't follow these instructions.

  • Be sure that every file you submit includes your name, login, and precept number.

  • The readme.txt file must be a text file - MS Word format is unacceptable. Create it using the same editor that you use to write your C code.

  • Be sure that you do the following in your readme.txt file:

  • Write your name, login, and precept number.

  • Write which operating system and C compiler you used (e.g., Windows 2000 lcc126, Mac OS X gcc126, or arizona gcc126).

  • Write which editor you used (e.g., wedit, ProjectBuilder, xemacs).

  • List whatever help (if any) that you received.

  • Describe any serious problems you encountered.

  • Do not exceed 80 characters per line. (You may need to put in manual line breaks if your editor does not do this automatically.) The submission system will give you a warning if you exceed the limit.
  • Here is a readme file template to get you started.


  • Enrichment Links

  • If you need pseudo-random numbers in real scientific applications, we recommend the Mersenne Twister. For cryptographic applications, use only pseudo-random numbers that are cryptographically secure such as Yarrow.



  • Kevin Wayne