CS 2223, Algorithms
B Term, 2011
Prof. Joshua D. Guttman

Email: last name@wpi.edu
Office: FL 137

Class meetings: Lower Perrault Hall, MT RF, 2-2:50


 

Course Description
Personnel
Textbook
Recommended Background
Grading
Exams
Homework
Projects
Language







 

Warning: This syllabus is subject to change!

 

Course Description

CS 2223. ALGORITHMS. Cat. I Building on a fundamental knowledge of data structures, data abstraction techniques, and mathematical tools, a number of examples of algorithm design and analysis, worst case and average case, will be developed. Topics include greedy algorithms, divide-and-conquer, dynamic programming, heuristics, and probabilistic algorithms. Problems will be drawn from areas such as sorting, graph theory, and string processing. The influence of the computational model on algorithm design will be discussed. Students will be expected to perform analysis on a variety of algorithms.
Undergraduate credit may not be earned both for this course and for CS 507.
Recommended background: CS 2102 and CS 2022.


 

Class schedule

The class schedule (subject to small changes) is here.

 

Personnel

  • Professor Joshua D. Guttman
    Office hours in FL 137:
    • Monday 11:00 -- 12:00 and 3:00 -- 4:00
    • Thursday 10:00 -- 11:00
    • Friday 3:00 -- 3:30 as needed
  • Teaching Assistants
    • Fei Song
      Office Hours: Fuller Labs 314
      • Monday 10:00 -- 12:00
      • Wednesday 10:00 -- 11:00
      • Thursday 3:00 -- 4:00
    • Shubhendu Trivedi
      Office Hours: Fuller Labs 314
      • Tuesday 3:00 -- 4:00
      • Wednesday 2:00 -- 4:00
      • Thursday 5:00 -- 6:00

Class Mailing Lists: To reach the members of the cs2223 staff, please send mail to the staff mailing list. Its address consists of the string "cs", followed by the course number and a hyphen, and then the word "staff". It's a mailing list at cs.wpi.edu.

To reach all students in the class, as well as the staff, please substitute "all" for "staff". Send email to the whole class very sparingly.


 

Textbook

Required Textbook:

T.H. Cormen, C.E. Leiserson, R.L. Rivest, and C. Stein. Introduction to Algorithms.
Third Edition, MIT Press, 2009. ISBN 978-0-262-03384-8.


Another Good Textbook:

J. Kleinberg, E. Tardos. Algorithm Design. Addison-Wesley, 2005.


Additional materials:

Seven Rules for big-O, Theta Comparisons

CS 2223 in Four Pages, a summary of the core material of the course.

Recommended Background


 

Grading

Exam 1 15%
Exam 2 15%
Exam 3 20%
Homework (5)      0%
Projects (5) 45%
Participation     5%

Your final grade will reflect your own work and achievements during the course. Any type of cheating will be penalized in accordance with the Academic Honesty Policy.

Students are expected to read the material assigned to each class in advance and to participate in class. Class participation will be taken into account when deciding students' final grades.


 

Exams

There will be a total of 3 exams. The final exam is cumulative. The exams will be based on material covered by the homework assignments.

Exam dates:
  1. Monday, 14 Nov Exam 1
    Topics: Sorting; big-Oh Omega and Theta notation
  2. Tuesday 29 Nov Exam 2
    Topics: Heaps, priority queues, binary search trees; greedy algorithms
  3. Thursday, 15 Dec Exam 3
    Cumulative: Includes also dynamic programming; graph algorithms

Homework

Five homework sets will be assigned. They are intended to allow you to master the theoretical side of the course content.

However, we will not collect the homework, and it will not be part of the course grade.

Why should you do the homework? Even though the homework isn't graded, it's very important. If you can solve the problems in the homework sets, you'll do well on the exams. Exam questions will be engineered to be very similar to the ones in the homework sets.

You can collaborate on homework. In fact, you are strongly encouraged to work together in groups. People learn by talking, by sharing ideas, by finding gaps and flaws, by collaborating to fill them. This is also how scientific research happens. This way of studying is both enjoyable and effective.

Homework should be completed Thursdays:

  1. Thursday, 3 Nov The first homework set is now available here.
  2. Thursday, 10 Nov The second homework set is now available here.
  3. Monday, 28 Nov The third homework set is now available here.
  4. Monday, 5 Dec The fourth homework set is now available here.
  5. Thursday, 8 Dec The fifth homework set is now available here.


 

Programming Projects

There will be five programming projects. They are intended to give you a practical mastery of the course material. They will give you opportunities to apply, measure, and adapt the algorithms discussed in the course.

Programming projects are individual work. You may not share code; you may not ask someone to look at your code and help you correct it (except the TAs and professor); you may not assist a student. Any type of cheating will be penalized in accordance with the Academic Honesty Policy.

The programming projects will be due Monday nights (generally) at midnight (i.e. at the end of the Monday). The due dates will be:

  1. Monday, 31 Oct: Now on line at proj1/proj1.pdf! Starter code is at proj1/proj1.lua
  2. Saturday, 12 Nov Now on line at proj2/proj2.pdf! Starter code is at proj2/proj2.lua
    Be sure to get the new init code at proj2/init.lua.
  3. Monday, 28 Nov Now on line at proj3/proj3.pdf! Starter code is at proj3/proj3.lua and proj3/min_heaps.lua.lua.
    Be sure to get the new init code at proj3/init.lua.
  4. Monday, 5 Dec Now on like at proj4/proj4.pdf! Starter code is zipped in proj4/all_lua.zip!
  5. Wednesday, 14 Dec due at noon Now on line at proj5/proj5.pdf! Starter code is available in directory proj5, or else all tarred in proj5/prim_all.tar!

Late policy for projects: You can hand in projects late. But there's a cost associated. Each 24 hours (or part thereof) late will cost you 10%.

Thus, if you hand something in that would have been worth 93 on time, but it's 36 hours late, that means that you only get 93(.9)(.9)=75.

So, yes, you can hand things in late, but it's expensive, and very expensive if you do it often.


 

Programming Language: Lua

All the programming projects will be done using Lua. Lua is a very simple programming language, designed to allow the maximum computational content to be expressed with a minimum of syntactic clutter and verbosity. It is a procedural language like C and Java, but has excellent support for recursion and higher-order functions. In this regard it is as good as Scheme.

I will schedule Lua Labs early in the term, and I will write up a small guide to Lua. One of the advantages of Lua is that it has fairly few gotchas. Three main gotchas are:

  • Forgetting the return statement. If a function finishes without encountering a return statement, it returns nil. This is the most annoying single thing about the language, I think.
    When your code is behaving buggily, always check that you haven't left out a return statement.
    return doesn't make the function return, it only tells it what value it should return if in fact it is returning.
  • Forgetting local when declaring a local variable. Inside a function,
    local varname = initval 
    declares a local variable named varname. Nothing of the same name in any other scope (or recursive call) can be affected. Leave out the word local, and things will go haywire.
  • You must use the word then to start the then-clause of a conditional. Unlike C and Java, a conditional takes the form

    if condition then statement1 else statement2 end

    The else part is optional.

You can download Lua for the main types of system here, and Windows users often like Lua for Windows.

I will put three copies of the Lua Reference Manual on reserve in the library, but I mainly use the online version. They have a very nice book on Programming in Lua. The version that's free on line is not 100% up-to-date, but it is totally adequate for the parts of the language we'll use in this course.

A recent survey of the popularity of programming languages from TIOBE reports for October 2011 that Lua has surged in popularity during the past year. It has risen eight positions, and is now 16th in popularity.

We have gathered some instructions, and Lua Lab times, and pointers to some code, at

Page for CS 2223 Lua code