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

Email: lastname@wpi.edu
Office: FL 137

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


 

Course Description
Personnel
Textbook
Recommended Background
Grading
Tests
Homework
Projects
Language







 

Warning: This syllabus is subject to small changes.

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.
Recommended background: CS 2102 and CS 2022.


 

Class schedule

The class schedule (subject to small changes) is here.
Recently updated post-hurricane. Test 1 will be Monday 5 Nov.

 

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
    Available at other times also; send email with [cs223] in the subject line to schedule meetings.
  • Teaching Assistants Office hours in FL 314
    • Fei Song
      • Tuesday 10:00 -- 11:00
      • Wednesday 1:00 -- 2:00
      • Thursday 3:00 -- 4:00
    • Linglong Zhu
      • Monday 9:00 -- 10:00
      • Wednesday 11:00 -- 12:00
      • Thursday 9:00 -- 10:00
  • Student Assistant Xianjing Hu FL A22
    • Wednesday 3:00 -- 4:00
    • Thursday 11:00 -- 12:00
    • Friday 10:00 -- 11:00

Class Mailing Lists: To reach the members of the cs2223 staff, please send mail to the staff mailing list. Its address is cs2223 dash staff at cs dot wpi dot edu

To reach all students in the class, as well as the staff, you can 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:

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

A few slides on orders of growth

Seven Rules for big-O, Theta Comparisons

The Master Theorem

A number of sample programs used in class are gathered in in sample_programs.

Recommended Background


 

Grading

There will be five tests, but the first four will be less than the full class period. With more tests, we hope to give lower-stress, more incremental feedback.
Tests 1--4 8% each      32% total
Test 5 14%
Homework (4)      1% each 4% total
Projects (5) 9% each 45% total
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.

Policy on late work: Homework sets will not be accepted late. This means that students can ask questions about the homework in class, any time after the due date. Each homework set contributes only one point to the final grade.

Programming projects may be handed in late. You can hand in projects whenever you want. But there's a cost with late submission. Each 24 hours (or part thereof) late will cost you 10% (multiplicatively).

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 programming projects in late, but it's expensive, and very expensive if you do it often. This policy allows students to make rational choices in planning when and how to do the work, and also ensures that the cost is not extreme if something unexpected comes up.


 

Tests

There will be a total of 5 tests. The first four will take less than a full class session. The final test is cumulative. The tests will be based on material covered by the homework assignments.

Test dates and topics:
  1. Monday, 5 Nov Test 1
    Topic: big-Oh, Omega, and Theta notation.
  2. Friday, 9 Nov Test 2
    Topic: Graph search (BFS, DFS).
  3. Monday, 26 Nov Test 3
    Topic: Greedy and divide and conquer algorithms, solving recurrences.
  4. Monday, 3 Dec Test 4
    Topic: Dynamic programming algorithms, solving recurrences.
  5. Thursday, 13 Dec Test 5
    Retrospective.

Any scheduling issues must be discussed in advance.

Homework

Four homework sets will be assigned. They are intended to allow you to master the theoretical side of the course content. Homework will be submitted to turnin. Each homework set is worth only one percent of the course grade, and we will not grade them individually. The one percent score simply reflects the fact that you turned it in on time.

Why should you do the homework? Test questions will be engineered for maximal similarity to some of the questions in the homework sets. That's why, even though the homework isn't graded individually, it's very important. If you can solve the problems in the homework sets, you'll do well on the tests. If asking for extra points on a test question, you'll want to be able to point to what you did on related homework questions.

The homework sets will also contain some open-ended, challenging questions. Use them to deepen your understanding. You don't have to answer them all completely, but formulate a strategy on each and work out a few fully. They are excellent subjects for group discussion and collaboration.

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 due dates:

  1. Thursday, 1 Nov The problem set is now available here. A version with answers to the first batch of questions is now here. Answers to the CLRS questions are now here.
  2. Wednesday, 7 Nov Now available here. Answers to the first group of questions are now available.
  3. Monday, 19 Nov The problem set is now available here.
    Answers to the first group of questions are now available.

  4. Sunday, 2 Dec The problem set is now available here. Answers to part A are now here.

Handwritten homework may be scanned or photographed---if legibly written and photographed in strong light with sharp focus---and then submitted as a zip file of PDFs or JPEGs. You may also use document preparation software. Use Turnin to submit homework.


 

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 SA, TAs and professor); you may not assist a co-student. Any type of cheating will be penalized in accordance with the Academic Honesty Policy.

The programming projects will be due Mondays (generally, except Friday 30 Nov). The submission is not late if handed in at any time on the due date (US Eastern time :-). For instance, if you hand it in at 11:47 pm on the due date, then it's not late.

Caution: Turnin has sometimes crashed around midnight, on nights when various classes have things due. I recommend submitting partial results early.

The due dates will be:

  1. Monday, 5 Nov The first problem set description is now here, and the starter code is here. Use this code also as a starting point to explore Lua.
  2. Monday, 12 Nov The second problem set description is now here, and the starter code is here.
    Some notes on Project 2 are at proj/proj2_notes.pdf. As people ask questions and we answer them, this document will grow, so please look back here as problems arise. And if you don't see an answer, please ask!
  3. Tuesday, 20 Nov The third project is now here, and the starter code is at proj/proj3.zip.
    Some notes on Project 3 are at proj/notes_proj3.pdf. As people ask questions and we answer them, this document will grow, so please look back here as problems arise. And if you don't see an answer, please ask!
  4. Monday, 3 Dec The fourth project is now described here and the starter code is in this Zip file.
  5. Monday, 10 Dec The last project is now described here and the starter code is in this Zip file.
    Some notes on Project 5 are now at proj/notes_proj5.pdf.

Use Turnin to submit projects.

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% (multiplicatively). See above.


 

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. Windows users often like to use the Scite editor, and Macintosh users often like TextWrangler. Both are freely available, and easy to find by googling. I like Emacs, using the lua-mode available on the web. It gives excellent support for running Lua interactively as a subordinate process under Emacs.

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 2012 that Lua has risen slightly popularity during the past year. Last year it surged, and rose eight positions from 2010. It is now 16th in popularity.

Lua Labs:

I will schedule Lua Labs early in the term. These will be sessions to sit down in groups and go over problems, examples, and tricks.

Before coming to a Lua Lab, please download and install Lua on your system. It's available here. If possible, try to run a few examples. Lua labs are currently scheduled in FL 137 for:

  • Thurs, 25 Oct, 10:00 -- 11:00 (office hr)
  • Fri, 26 Oct, 10:00 -- 10:45, 3:00--4:00
  • Mon, 29 Oct, 11:00 -- 12:30 and 3:00 -- 4:00 (office hr)
  • Thurs, 2 Nov, 10:00 -- 11:00 (office hr)

A number of sample programs used in class are gathered in in sample_programs.