CS 35: Data Structures and Algorithms
Spring 2013


Instructor: Adam Aviv
Office : Science 255
Office hours: Wed. 11-12PM and Fri. 11-12pm (and by appointment)

Lecture Room: Science 183
Time: Tue/Thur 9:55-11:10

Lab Room: Science 256
Lab (A) Time: Wed. 1:00PM - 2:30PM
Lab (B) Time: Wed. 2:40PM - 4:10PM

Ninja Session Time: Sun. 7:00PM - 11:00PM
Ninja Session Location: Science 240

Newsgroup: Piazza Newsgroup (by invitation)

Announcements


Course Description

Welcome to CS35. This course continues the broad introduction to computer science begun in CS21, providing a general background for further study in the field. By concentrating on data structures and algorithms, you will obtain the basic building blocks by which all large software are built. These topics are central to every sub-discipline in computer science, and also connect to central concepts across the sciences. Topics to be covered include object-oriented programming in C++, advanced data structures (such as priority queues, trees, hash tables, and graphs), advanced algorithms, as well as software design and verification. At the end of this course, you will have obtained the ability to successfully analyze problems in the discipline. You will also take your first steps towards developing the skills necessary to synthesize and evaluate the must fundamental questions in the field.

To enroll in this course you must have completed CPSC 21 or obtain permission from the instructor. This course is designated as a natural sciences and engineering practicum.

Course Goals

Course textbook:

Course pre-requisites:


Support

Ninjas and Student Coordinator

The CS Ninjas will assist in our in-class lab sessions and run study sessions in the main CS lab (Science Center 240). The time for CS34 Ninja sessions are still to be determined.

You are encouraged to participate in these study sessions to prepare for quizzes, to discuss programming concepts, and to get friendly assistance in working on homework assignments.

Academic Accommodations

If you believe that you need accommodations for a disability, please contact Leslie Hempling in the Office of Student Disability Services, located in Parrish 130, or e-mail lhempli1 to set up an appointment to discuss your needs and the process for requesting accommodations. Leslie Hempling is responsible for reviewing and approving disability-related accommodation requests and, as appropriate, she will issue students with documented disabilities an Accommodation Authorization Letter. Since accommodations may require early planning and are not retroactive, please contact her as soon as possible. For details about the Student Disabilities Service and the accomodations process, visit http://www.swarthmore.edu/student-life/academic-advising-and-support/student-disability-services.xml. You are also welcome to contact me privately to discuss your academic needs. However, all disability-related accommodations must be arranged through Leslie Hempling in the Office Of Student Disability Services. To receive an accommodation for a course activity, you must have an Accomodation Authorization letter from Leslie Hempling and you need to meet with me to work out the details of your accommodation at least two weeks prior to any activity requiring accomodations.


Assessment

Grading Breakdown

Lab Policy

All assignments are due at the time and date specified on the lab write-up. Generally, labs are due Tuesday night at 11:59pm Lab submissions is electronic via handin35, and you may submit multiple times, but each submission overwrites the previous and only the final submission is graded. Unless otherwise stated, you should assume that the lab assignment is to be done individually, and all written assignments must be completed individually even if the programming portion is group oriented.

Late Policy

Each individual is allotted 2 late days for the semester, and a late day may be used for any reason -- illness, interviews, paper deadlines, etc.. Once your late days are used up, labs will not be accepted unless there is serious extenuating circumstances; the fact that you have a lot of other stuff due then is not an extenuating circumstance, sorry. You should budge your 2 late days to account for any future eventualities. Even if you do not fully complete a lab assignment you should submit for partial credit. You must notify the instructor at least 1 day prior to lab deadline (i.e., Monday), and you will use the alternative handin43.late submission program.

Lab Grading

Lab's are graded on a 10 point scale. As a baseline, a fully functional submission should receive a base score of 9/10 prior to code review. After code review, the score may be adjusted up or down depending on the design, quality, and style of the program. A non-functioning lab submission should receive a base score of 7/10 prior to code review, and after code review, the score may be adjusted up or down depending on the amount completed and the quality of the submission. Each student will receive a separate grade for the lab, even if it is a group lab. Some labs will have extra credit options with designated point numbers. Completing extra credit can only affect the grade on that lab.

Participation/Attendance Policy

Your participation grade will be based on class and lab attendance, as well as participating in the online discussion on Piazza. I do not take attendance in lecture, but I will notice if you are absent. Attendance in lab is mandatory, and attendance will be taken. You must attend the lab session you've been assigned. If you cannot make your lab session, we can adjust the roster the first week so that you can switch labs. With permission, you can attend the other lab section for a week if anything arises.

Academic Integrity

Bellow is the academic integrity statement generally used in CS courses, source: Ameet Soni

Academic honesty is required in all work you submit to be graded. With the exception of your lab partner on approved lab assignments, you may not submit work done with (or by) someone else, or examine or use work done by others to complete your own work. 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.

All code you submit must be your own with the following permissible exceptions: code distributed in class, code found in the course text book, and code worked on with an assigned partner. In these cases, you should always include detailed comments that indicates on which parts of the assignment you received help, and what your sources were.

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. You may discuss assignment specifications and requirements with others in the class to be sure you understand the problem. In addition, you are allowed to work with others to help learn the course material. However, with the exception of your lab partner, you may not work with others on your assignments in any capacity.

``It is the opinion of the faculty that for an intentional first offense, failure in the course is normally appropriate. Suspension for a semester or deprivation of the degree in that year may also be appropriate when warranted by the seriousness of the offense.'' - Swarthmore College Bulletin (2008-2009, Section 7.1.2)

Please see me if there are any questions about what is permissable

Class Schedule

This schedule is subject to change without notice, and all dates should be considered tentative.

Week Date Topics/Announcments Readings Lab
Unit 1: C++/OOP
1 Jan 22
Intro to CS35 and C++
[Lec. 1.0, Lec. 1.1]
Chapter 1 : 1.1-1.1.2,
Focus Topics:
  • Page 10,555 (strings & Strings in the STL),
  • page 16 (using), 1.2-1.4.1
  • page 23-26 (control flow) 1.3
Lab 0: Arrays, Matrices, Oh My! [ pdf ]
Jan 24 Intro to C++ (cont)
[Lec. 1.1]
2 Jan 29
C++ functions and I/O
[Lec. 1.2]

Chapter 1: 1.4, 1.5, 1.6
Focus Topics:
  • Page 7-13 (Pointers & Arrays) 1.1.3,
  • Page 28-29 (Functions Argument passing) 1.4.1
  • Page 37-40 (Constructors & Destructors) 1.5.2
  • Page 47-53 (Headers & Source Files) 1.6
Lab 1: Cellular Automaton [ pdf ]
Jan 31 C++ Classes
[Lec. 2.1]
3 Feb. 5
C++ Classes (continued)
[ Lec 2.1 ]

Chapter 2: 2.1, 2.2, 2.3
Focus Topics:
  • Page 73 (Protection)
  • Page 76 (Virtual)
  • Page 87 (Interfaces and Abstract Classes)
Lab 2: Swat ATM (Machine (Machine)) [ pdf ]
Topic: Debugging GDB and Valgrind
Feb. 7
C++ Inheritance
[Lec 3.1]

Unit 2: Algorithms Analysis and Ordered Structures
4 Feb. 12
No Lecture

Quiz 1 (in lab Feb 13th)

Chapter 4: 4.1, 4.2
Focus Topics:
  • Page 161: Comparing Growth Rates (4.1.8)
  • Page 166-167: Asymptoic Analysis (4.2.3)
  • Page 171: Big-Oh Notation (4.2.5)

Quiz 1
Feb. 14 Algorithm Analysis and Complexity
[ Lec 4.1 ]
5 Feb. 19 Guest Lecture
Dynamic Programming in Biology
Prof. Ameet Soni
Chapter 4: 4.3.3
Focus Topics:
  • Page 183: Induction (4.3.3)
  • Page 184: Loop Invariants (4.3.3)
Lab 3: Algorithm Analysis [ pdf ]
Topic: Loop Invariants and Induction
Feb. 21
Abstract Classes and Lists
[Lec 5.1]
6 Feb. 26

No Lecture

Chapter 3: 3.1, 3.2, 3.3
Focus Topics:
  • Page 106: List Insertion
  • Page 117: Singly Linked Lists
  • Page 121: Templates and Linked Lists
  • Page 123: Doubly Linked Lists
Lab 4: On Lists and Light Sabers [ pdf ]
Topic: ArrayLists and Templates
Feb. 28 Linked Lists
[Lec 6.1]
7 Mar. 5

Stacks and Queues
[Lec 7.1]

Chapter 5: 5.1 5.2
Chapter 11: 11.1
Focus Topics:
  • Page 195: Abstract Stack Data Type
  • Page 208: Abstract Queue Data Type
  • Page 212: Implementing a Circular Array
  • Page 500: Divide-and-Conquer
  • Page 506: The Running Time for Merging
Open Lab Time: Work on Lab 4 with your partner!
Mar. 7 Guest Lecture:
Merge Sorting
Prof. Ameet Soni
Spring Break 5/11-5/15
Unit 3: Trees, Dictionaries and Hash Tables
8 Mar. 19


Quick Sorting
Operator Overloading
[Lec 8.1]

Chapter 11: 11.2, 11.3.3
Chapter 1: 1.4.2
Chpater 7: 7.1, 7.2
Focus Topics:
  • Page 513: High Level Description of Quick-Sort
  • Page 519: Quick-Sort Pseudo-code
  • Page 521: Randomized Quick-Sort
  • Page 531: Comparing Sorting Algorithms
  • Page 31: Operator Overloading
  • Page 269: Formal Tree Definition
  • Page 278: Preorder Traversal
  • Page 281: Postorder Traversal
Lab 5: Amazing Mazing [ pdf ]

Quiz 2 (takehome) [ Study Guide ]
Mar. 21 Trees
[Lec 8.2 (replacement)]
9 Mar. 26



Binary Search Trees
[Lec 9.1]

Chapter 7: 7.3
Chapter 10: 10.1, 10.2
Focus Topics:
  • Page 287: Properties of Binary Trees
  • Page 289: Linked Structured for Binary Trees
  • Page 292: Binary Tree Update Functions
  • Page 297: Traversal of Binary Trees
  • Page 427: Analysis of Binary Tree Searching
  • Page 428: BST update operations
  • Page 438: Definition of an AVL Tree
  • Page 440: AVL update operations
  • Page 443: Single and Double Rotations
  • Page 445: Performance of AVL Tree
Lab 6: "Release the Crack-ing" [ pdf ]
Mar. 28 Balanced Binary Search Trees
[Lec 9.2]
10 Apr. 2

Priority Queues and Binary Heaps
[Lec 10.1]


Chapters 8: 8.1, 8.2, 8.3
Focus Topics
  • Page 331: Implementation with an Unsorted List
  • Page 332: Implementation with a Sorted List
  • Page 337: Heap Order Priority
  • Page 338: Complete Binary Tree Property
  • Page 344: Heap Insertion
  • Page 346: Heap remove
  • Page 351: Heap Sort
Lab 7: Web Page Indexing [ pdf ]
Apr. 4 Implementing a Binary Heap
[Lec 10.2]
11 Apr. 9

Dictionaries and Hash Tables
[Lec 11.1]

Chapter 9: 9.1, 9.2, 9.5
Focus Topics:
  • Page 370: Map ADT functions
  • Page 376: Hash Functions
  • Page 382: Collision Handling: Sepearte Chaining
  • Page 384: Collision Handling: Linear Probing
  • Page 385: Collision Handling: Quadratic Probing
  • Page 385: Collision Handling: Double Hashing
  • Page 386: Rehashing
  • Page 411: The Dictionary ADT
Lab 8: Ordered Search Results [ pdf ]
Apr. 11 Hash Functions
Collision Avoidance
[Lec 11.2]
Unit 4: Graphs and Advance Programming
12 Apr. 16 Hash Probing and Chaining
Intro to Graphs
[Lec 12.1]
Chapter 13: 13.1, 13.2
Focus Topics:
  • Page 594: Graph Definitions
  • Page 599: Graphd ADT
  • Page 603: Adjacency List
  • Page 605: Adjacency Matrix
Lab 9: Hash Tables [ pdf ]
Quiz 3
[ Study Guide ]
Apr. 18 Graph Implementations
[Lec 12.2]
13 Apr. 23 Graph Shortest Path Algorithms
Breadth First Search
[Lec 13.1]
Chapter 13: 13.3, 13.5
Focus Topics:
  • Page 623: Breadth-First Search
  • Page 639: Dijkstra's Algorithm (Greedy Method)
  • Page 642: Why it works
  • Page 644: Running Time of Dijkstra's.
Lab 10: The Oracle of Bacon [ pdf]
Apr. 25 Dijsktra's Algorithm
[Lec 13.2]
14 Apr. 30
Mininum Spanning Trees
Primm's vs. Kruskals
Disjoint Sets
[Lec 14.1]

Chapter 13: 13.6
Focus Topics:
  • Page 645: Problem Deffinition
  • Page 647: Kruskal's Algorithm
  • Page 650: Running time of Kruskal's
  • Page 651: Prim-Jarnik Algorithm
  • Page 652: Analyzing Prim-Jarnik

Advanced C++
C++ Reference Types
Guest Lecture: Peter-Michael Osera
Lecture Slides [PDF]
May 2 Currioursly Recurring Templates
Guest Lecture: Matt Zucker