CS 112 - Introduction to CS II - Fall 2016

[Resources | Staff Contact Information | Course Schedule ]


Staff Contact Information

Quick Links

Piazza Discussion Forum

Tutoring and Office Hours Schedule

Homework Submission and Grading Policies

Quick Start Guide to Dr. Java

Dr. Java User Documentation

Learning Java Online

Aaron Stevens YouTube Lectures on Java

The Java Tutorials

Java Style Guidelines for CS112

Course Syllabus

Policy on Collaboration

Useful Links



Wayne Snyder
     Email: waysnyder@gmail.com
     Office: MCS 290
     Office Hours: W & R, 3:00 - 6:00pm

Teaching Fellows:

Gautam Bhat  (gautam@bu.edu) (lab sections A2,A3,A4)

Daniel Valentine (dval@bu.edu) (lab sections A5,A6,A7)

Course Assistants and Labs

  • A2 (Thurs 2-3): Chloe Fortuna (cfortuna@bu.edu)
  • A3 (Thurs 3-4): Tyrone Hou (tyroneh@bu.edu)
  • A4 (Thurs 4-5): Viviana Yee (vivyee@bu.edu)
  • A5 (Thurs 5-6): Amalia Safer (asafer@bu.edu)
  • A6 (Thurs 6-7): Ben Gaudiosi (gaudiosi@bu.edu)
  • A7 (Thurs 7-8): Sean Smith (swsmith@bu.edu)



Professor Snyder

Gautam Bhat

Daniel Valentine



Course Schedule

Back to Top

Lecture Topic
Readings (Java = "Java in a Nutshell")
Lecture Slides and Code Examples
Homeworks and Tests
T 9/6

Overview of Course & Course Policies; Motivational Lecture: Two algorithms for searching an array---algorithm, implementation, analysis, and experiments

Syllabus: HTML

Lecture 1: PDF


R 9/8 A first look at Java: compilation vs interpretation, expression-oriented vs statement-oriented, basic program structure, assignments, values, expressions, types

Install Dr. Java from the www.drjava.org and from the Help menu (or using the link above in Quick Links), go to the Quickstart and read part 3: "Using Dr. Java, The Basics."

[Optional: Look at the following short YouTube video by Aaaron Stevens, one of our 111 instructors: 01]

For Mac Users: During install if you get the message "'Dr Java.app' is damaged and cannot be opened. You should move it to the trash," go to System Preferences > Security & Privacy and change the "Allow apps" to "Anywhere."

Read Chapter 2 of Java until you get to Increment and Decrement Operators on p. 35. NOTE: this is a reference book, and you do not need to know every picky little detail about every operator. Please read through with an eye for the big picture, and use the following resources to supplement as needed:

[Optional: At LearningJavaOnline: go through exercises for

  • Hello World
  • Variables and Types]

[Optional: Look at the following (short) YT videos by Professor Stevens: 02, 03, 05, 08]



Lecture 2: PDF

HW01:HTML (due W 9/14)

Part A Solution: HTML

Solution to Test Cases in Grading File for Statistics.java: PDF


Lab 01:HTML
3 T 9/13

Finish expressions, increment and decrement operators.

Control Structures: if, if-else, while, for, break and continue;

Continue to read Chapter 2 in Java about the following:

Operators: Increment and Decrement Operators; Boolean Operators; Assignment Operator;

Statements: Expression Statements, Compound Statements, Empty Statement, local variable declaration statements; if/else; while; for; break; continue; return.

[Optional: At LearningJavaOnline: go through exercises for

  • Conditionals
  • Loops]

[Optional: Look at the following lectures: 09 (review of casting from last time), 10, 18, 21, 22

Lecture 3: PDF    
4 R 9/15

Arrays; Defining and using methods;

Continue to read Chapter 2 in Java about the following:

  • Arrays (pp. 70-73 in online pdf of Java book)
  • Methods

[Optional: At LearningJavaOnline: go through exercises for

  • Arrays
  • Functions]

[Optional: Look at the following YT lectures: 25, 26, 4, 12]

Lecture 4: PDF

HW 02: HTML (due W 9/21)

Part A Solution: HTML

Lab 02: HTML
5 T 9/20 Program Structure, Local variables vs fields; Scope of fields; the keyword static. Classes vs objects; creating (non-static) objects.

Read the section "Objects and Classes" (starting on p.66) in Java but skip the section "Object Literals", and ALSO the sections "The Members of a Class" and "Creating and Initializing Objects" (starting on p.88 of the online pdf).

[Optional: At LearningJavaOnline: go through exercises for

[Optional: Look at the following YT videos: 30a, 30b, 30c ]

Lecture 5: PDF    
6 R 9/22 Creating and using objects; the keywords public and private; Object-Oriented Design; Abstract Data Types.

Read section "Data Hiding and Encapsulation" but skip the section on "Access Control and Inheritance" and don't worry too much about the issues about "packages" (basically, a package is a folder/directory where code is stored).

[Optional, but an excellent summary: Read through section 2.12 here: HTML.]


Lecture 6: PDF HW 03: HTML (due W 9/28) Lab 03 (Debugging Strategies): HTML
7 T 9/27

Stacks and Queues as ADTs; implementing Stacks and Queues using arrays.

Reference types: How are the variables for arrays and objects different than for primitive types?

Strings and reference types; String comparison using equals(...) compared with ==.

Fixing a big problem with stacks and queues: Array resizing



Here is a short (3:40) and simple YT video about Stacks and Queues: HTML.

[Optional: Look at the Wikipedia entries on Stacks and Queues.]

Read Java section on "Reference Types" but stop when you get to "Terminology: Pass by Reference."


Lecture 7: PDF

Code from lecture: Stack.java

8 R 9/29 Implementing Queues with Ring Buffers.

Read about "Circular Buffers" on Wikipedia: HTML.

For lab, read about Java Interfaces here; stop when you get to the section "Interface Default Methods."


Lecture 8: PDF


Part A Solutions: HTML

Lab 04: Java Interfaces:

MiniLecture: PDF

Lab Writeup: HTML

9 T 10/4

Analysis of algorithms, "Big Theta" notation, experimental verification by timing analysis;

Introduction to sorting: Iterative sorts: Insertion Sort;




  Lecture 9: PDF    
10 R 10/6

Iterative sorts: Insertion Sort; Complexity analysis of iterative sorts.

Recursive sorting: Mergesort;

Complexity analysis of recursive sorts

  Lecture 10: PDF


Part A Solutions: HTML

Lab 05: HTML
  T 10/11 Monday Schedule -- No Class        

R 10/13

Introduction to Linked Lists; Stacks and Queues with LLs; Basic Iterative Algorithms   Lecture 11: PDF HW 06: HTML

Lab 06: Generics: HTML

MiniLecture: PDF

12 T 10/18 Iterative Algorithms on LLs Notes on Iterative LL Algorithms Used the board!    
13 R 10/20 Iterative Algorithms on LLs; Doubly-linked lists.

Notes on Iterative LL Algorithms

Used the board!


Solution to LinkedList problems: LinkedListPractice.java

Lab 07: HTML Doubly-linked lists
14 T 10/25 Iterative Algorithms on LLs; Other forms of linked lists.

Notes on Iterative LL Algorithms

Used the board!    
  R 10/27 Midterm

Here is a directory of some past midterms and solutions: DIR

Note: There are occasional references to topics (such as ~(...) or stability of sorting) that we did not cover this semester. Just ignore those questions.

Midterm Solutions:

Exam A: PDF

Exam B: PDF

HW 08: HTML No lab this week!
15 T 11/1 Recursive algorithms on LLs

  Notes on Recursion and LLs

Used the board!    
16 R 11/3 Recursive algorithms on LLs; other forms of linked lists Notes on Recursion and LLs

Used the board!


HW 09: HTML (due Th 11/10) Lab 09: HTML Java Iterators
17 T 11/8 Binary Trees, Binary Search Trees; Searching and Insertion in BSTs.


The Wikipedia article on BSTs is very good: HTML

Here is a nice online simulation of BSTs for you to play around with: http://visualgo.net/bst

Lecture 17: PDF    
18 R 11/10 Deletion from BSTs; Recursive tree traversals; Iterative tree traversals using an explicit stack or queue


Please read the following Wiki article on Tree Traversals: HTML

Lecture 18: PDF


Part A Solution: HTML

Lab 10: HTML Generics satisfying an interface
19 T 11/15

Efficiency of BSTs;

2-3 Trees


Lecture 19: PDF    
20 R 11/17 2-3 Trees concluded; B-Trees and external data structures

Here is a good explanation of 2-3 Tree Insertions: YouTube

Here is a good animation you can play with to verify your understanding: HTML

Used the board!

HW 11: HTML (long homework due 12/8)

Part A Solution: HTML

Lab 11: HTML Exceptions

MiniLecture: HTML

21 T 11/22 Array representation of binary trees; Binary Heaps, Heapsort MaxHeap.java Used the board!    
  W 11/23 Thanksgiving Break        
22 T 11/29 The (nearly) Perfect Data Structure; Hash Tables with Separate Chaining


Used the board!    
23 R 12/1 Hash Functions; Hash Tables with Linear Probing; HashTableLP.java Used the board!   Lab 12: HTML Hash Function Laboratory
24 T 12/6 Hash Tables with Linear Probing; Resizing Hash Tables by Rehashing; Performance of Hash Tables   Used the board!    
25 R 12/8 Conclusions; Comments on Final Exam; Course Evaluations     Extra Credit HW: HTML (due 12/18) No lab!
  Sat 12/17 Final Exam: 12:30 - 2:30pm in CAS 522        

Back to Top