CS 35 Algorithms and Object-Oriented Programming
TR 1:15-2:30pm, SCI 240
Spring 2006
Swarthmore College

Professor: Benjamin Kuperman
email: kuperman AT cs swarthmore edu
Please include "CS35" in the subject.
AIM: ProfKuperman
Office: SCI 253
Phone: 328-8665
Office Hours: Mon: 2:00pm - 3:30pm
Thurs: 9:00am - 11:00am

Contents


Course Description

From the department course description: This course completes the broad introduction to computer science begun in CPSC-021. It provides a general background for further study in the field. Topics to be covered include object-oriented programming in Java, imperative programming in C, advanced data structures (priority queues, trees, hash tables, graphs, etc.) and algorithms, software design and verification. Students will be expected to complete a number of programming projects illustrating the concepts presented.


Text and Useful Links

Weiss 3rd edition

The text for the course is Data Structures and Problem Solving Using Java, Third Edition by Mark Weiss. All of the code from the text is available on the author's website: http://www.cs.fiu.edu/~weiss/dsj3/code/code.html

You are welcome to use an older version of the textbook, but you'll be missing all code that deals with Java 1.5 features. You'll probably want to read up on them here:

Weiss 2nd edition

C Links

Java Links


Java Documentation

java.util.* 1.5.0 Local Copy
java.util.Scanner 1.5.0 Local Copy
java.util.List<E> 1.5.0 Local Copy
java.util.ArrayList<E> 1.5.0 Local Copy
java.util.LinkedList<E> 1.5.0 Local Copy
java.util.Iterator<E> 1.5.0 Local Copy
java.util.ListIterator<E> 1.5.0 Local Copy
java.util.PriorityQueue<E> 1.5.0 Local Copy
java.util.Comparator<E> 1.5.0 Local Copy
java.util.Hashtable<K,V> 1.5.0 Local Copy
java.util.TreeMap<E> 1.5.0 Local Copy
java.util.Collection<E> 1.5.0 Local Copy
java.lang.* 1.5.0 Local Copy
java.lang.System 1.5.0 Local Copy
java.lang.Exception 1.5.0 Local Copy
java.lang.Character 1.5.0 Local Copy
java.lang.Integer 1.5.0 Local Copy
java.lang.Math 1.5.0 Local Copy
java.lang.String 1.5.0 Local Copy
java.lang.StringBuffer 1.5.0 Local Copy
java.io.* 1.5.0 Local Copy
java.io.File 1.5.0 Local Copy
java.io.FileInputStream 1.5.0 Local Copy
java.io.Serializable 1.5.0 Local Copy
java.awt.* 1.5.0 Local Copy
java.awt.Color 1.5.0 Local Copy
java.awt.FlowLayout 1.5.0 Local Copy
java.awt.BorderLayout 1.5.0 Local Copy
java.awt.GridLayout 1.5.0 Local Copy
java.awt.GridBagLayout 1.5.0 Local Copy
java.awt.event.ActionListener 1.5.0 Local Copy
javax.swing.* 1.5.0 Local Copy
javax.swing.JFrame 1.5.0 Local Copy
javax.swing.JPanel 1.5.0 Local Copy
javax.swing.JLabel 1.5.0 Local Copy
javax.swing.JButton 1.5.0 Local Copy
javax.swing.JComboBox 1.5.0 Local Copy
javax.swing.JTextField 1.5.0 Local Copy
javax.swing.JTextArea 1.5.0 Local Copy
javax.swing.JEditorPane 1.5.0 Local Copy
Thanks to Richard Wicentowski for this table format.

Grading

Grades will be calculated based on the following distribution:

Programming projects will generally consist of two major components:

  1. An underlying data structure implementation
  2. An application of this data structure
The actual breakdown of points will depend on the individual project, but the plurality of points will be for the data structure implementation. Projects will also be graded on style, documentation, and test cases.

If a portion of your program is not working correctly, please clearly indicate it in the comments at the beginning of the file and in the methods that are not working. Problems that I discover are graded more severely than those you discover.


Homework and Course Policy

Attendance

Regular class attendance is expected. I am required to report to the dean any student whose repeated absences is impairing their performance in the class.

Please talk to me if regular class attendance is going to be a problem.

Programming Assignments

There will be a number of assignments made in this class. I expect every student to attempt each assignment and turn in the results. You are encouraged to complete every assignment as this is one of the most effective ways to learn the material.

If you fail to submit 3 or more assignments, I will not give you credit for the course.

When homework is assigned, a due date will be made available (usually Tuesday at 11:30pm). You are responsible for submitting your answers before the deadline.

If you know that for some reason you will not be able to submit the assignment before the deadline, you should contact me in advance of the deadline. Extensions are only granted in exceptional circumstances, but need to be done in advance.

Note on late projects: Normally, I do not accept late projects. This semester I am going to deviate from my policy and allow students to submit assignments late with the following penalty scale:

Because I want every student to complete these assignments, correct and working submissions after 24 hours may be accepted and used to give some minimal score for the project.

Extra credit will not be accepted after the initial deadline.

To submit a late assignment, you will need to create a tar file and email it to me. To submit a late assignment for homework XX you need to:

Change into your homework directory

    % cd ~/cs35/homework/

Tar up all the files (but not the class files [unless you really need them])

    % tar czvf ~/yourname-hwXX.tar.gz --exclude=\*.class  XX

And email them to me

    % mutt -a ~/yourname-hwXX.tar.gz -s"cs35 HW XX (late)" kuperman
    

Grading

Programming assignments will be graded on both correctness as well as programming style. Good programming style includes the following:

More information on Java style can be found on Sun's Code Conventions web page. There is also an open source tool checkstyle that can be used to check the style used.

(This may be revised during the course)
Programming assignments will be graded on a 5 point scale. A perfectly working solution is only worth 4 points. Doing extra credit, using good programming style, and effective use of comments are necessary to have a higher score. In general, the breakdown is as follows

If it helps, you can think of a 4 as the lowest A, 3 as a B, and so forth. The differences between a 4 and a 3 are much smaller than those between a 1 and a 0. Just add 5 and consider it out of 10 pts.

Plagiarism and Academic Dishonesty

The College's Judiciary Committee (CJC) handles plagiarism offenses. The penalties for plagiarism are quite severe: usually the first offense leads to failure in the course, but it may additionally result in suspension. The following constitutes plagiarism on CS programming assignments:

Under no circumstances may you hand in work done with (or by) someone else under your own name. Your code should never be shared with anyone; you may not examine or use code belonging to someone else, nor may you let anyone else look at or make a copy of your code. This includes sharing solutions after the due date of the assignment. Failure to abide by these rules constitutes academic dishonesty and will lead to a hearing of the College Judiciary Committee.

Discussing ideas and approaches to problems with others on a general level is fine (in fact, we encourage you to discuss general strategies with each other), but you should never read anyone else's code or let anyone else read your code. If you are in doubt about some help that you received, then credit the person(s) from whom you got help by citing them in a comment at the top of the file and discuss the situation with your instructor.


Clinic

The CS35 clinician is an additional resource to help you with this class. The clinician is available for 3 hours per week and will help you with any problems you are having in the class. If you use the clinician to help you with your homework, please cite their help.

Alex Benn

Clinician: Alex Benn
Location: SCI 240
Hours: Sun, 1-4pm

Dan Amato

Clinician: Dan Amato
Location: SCI 240
Hours: Tue, 8-10pm


Schedule

(Subject to change)
WEEK DAY ANNOUNCEMENTS READING HW
1 Jan 17 Using Unix #1 (4-5pm)
Using Unix #1 (8-9pm) (Jan 18)
Course Introduction
  • Course policies
    • Homework
  • Review of expected Java background
  • Java 1.5 Features
  • Collections

(Review Ch 1-4,6)
HW0 - MadLibs
Jan 19  
2 Jan 24 Using Unix #2 (4-5pm)
Using Unix #2 (8-9pm) (Jan 25)
HW1 - MyArrayList
Jan 26 Last Day to Add/Drop (Jan 27) Algorithm Analysis
  • Big-Oh Notation
  • Algorithm Growth
  • Classes of algorithms

(Read Ch 5)
3 Jan 31 Vim Tips and Tricks (4-5pm) Recursion
  • PMI
  • Divide and Conquer
Data Structure: Stacks
Data Structure: Queues
(Read Ch 7.1-7.3, 7.7, 16)
HW2 - N-Queens
Feb 02  
4 Feb 07   Data Structure: Linked Lists
(Read Ch 17)
HW3 - PhoneList (MyLinkedList)
Feb 09   Data Structure: Trees
  • General
  • BST
  • AVL
  • Red-Black

(Read Ch 18,19)
5 Feb 14   HW4 - WordFrequencyTree
Feb 16  
6 Feb 21   Data Structure: Priority Queues
  • Heaps
  • Array based heaps

(Read Ch 21)
HW5 - ProcessQueries
Feb 23 Study session, SCI 240, 7pm
7 Feb 28 Midterm Exam [In Class]
Mar 02 No Class (SIGCSE Conference)
  Mar 07 Spring Break
Mar 09
8 Mar 14   Swing and Graphical User Interfaces
(Read Appendix B)
HW6 - GUI and MyHashtable
Mar 16   Data Structure: Hashtables
(Read Ch 20)
9 Mar 21  
Mar 23 Last Day to Withdraw with W (Mar 24) Introduction to C

Debugging

  • gdb
  • valgrind
10 Mar 28   HW7 - C: Calculator
Mar 30  
11 Apr 04  
Apr 06   Sorting Algorithms
  • Selection
  • Bubble
  • Insertion
  • Shell
  • Merge
  • Quick
  • Heapsort

(Read Ch 8)
HW8 - Sorting Algorithms
12 Apr 11  
Apr 13   Data Structure: Huffman Trees
  • File I/O
  • Data Compression

(Read Ch 12)
HW9 - Compress/Decompress
13 Apr 18   Data Structure: Graphs
  • Representation
  • Shortest Path
  • Topological Sorting

(Read Ch 14)
Apr 20  
14 Apr 25   HW10 - BaconNumber
  1. actors.small.txt
  2. top250.txt
  3. all.movies.txt
  4. all.txt
Apr 27 Final Exam Period: May 4-13 Finish up:
  • Review for final exam
  • Course evaluations
  May 09 Final Exam (2-5:00pm) - SCI 240

Assignments

In order to obtain and submit assignments for this class, we'll be using two tools:

First, you will need to run

update35
which will create a directory cs35 in your home directory.

Once an assignment is made, you can run update35 again and this will copy all needed files to ~/cs35/homework/X/ where you can then work on them. In class assignments will be distributed in a similar fashion.

If you want to get back to the original version of a file, all you need to do is rename/move your copy of the file to something else and re-run update35.

To submit your work, run

handin35
and follow the menus. Be sure to (v)erify your submission.


Last Modified: Sat 08 Apr 2006 10:43:28 AM EDT - Benjamin A. KupermanVI Powered