CS 112 - Introduction to CS II - Spring 2016

[Weekly Schedule | Lecture Schedule ]


Staff Contact Information


Wayne Snyder
     Email: waysnyder@gmail.com

     Office: MCS 276
     Office Hours:
T 2:30 - 3:30; W 1:30 - 4:30
     Cell Phone: 617 - 966 - (210 + 41) (email vastly preferred)

Teaching Fellows:

Alex Breen (abreen@bu.edu) (lab sections A2, A3, A4, A9)

Mike Breslav (breslav@bu.edu) (lab sections A5, A6, A7, A8)


Lecture Schedule

Back to Top

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

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


Lecture 1: PDF BW: PDF


R 1/21 Introduction to Java: compiled languages (Java) vs interpreted languages (Python); types, operators, and expressions.

Read Chapter 2 of Java up through "Expressions and Operators"

At LearningJavaOnline: go through exercises for

  • Hello World
  • Variables and Types

Install Dr. Java from the Dr. Java Web Site and from the Help menu, read through the Tutorial on "Using Dr. Java, The Basics," OR look at the following YouTube video by Aaaron Stevens, one of our 111 instructors: YT

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."

Lecture 2: PDF BW: PDF

HW01: HTML (due W 1/27 9pm)

Part A Solution: HTML

Lab 01: HTML
T 1/26 Java statements, conditionals, and loops; break and continue; methods; arrays.

In Java, continue to read Chapter 2 through the material on if/then, while, for, break, and continue; then read the section on methods, and skip ahead and read about arrays, just the about creating, using, and array literals (used to initialize).

There are lots of different kinds of statements, but for now we just need the basic ones.

LearningJavaOnline: go through exercises for

  • Conditionals
  • Loops
  • Arrays

YouTube videos: 10, 17,18, 25


Lecture 3: PDF BW: PDF


4 R 1/28

Methods and parameters;

Instance variables ("fields") vs local variables;

Scope and lifetime of declarations.


Please read about methods in the Java text; please read about the difference between local and instance variables here: HTML

For scope of declarations, take a look at this set of notes: HTML

In LearningJavaOnline: go through exercises for: Functions

YouTube video: 12

Used the board!


Part A Solution: HTML

Lab 02: HTML
5 T 2/2

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

Interative sorting algorithms: Selection sort, Insertion sort

Complexity analysis of iterative sorts;



Here is a good Youtube tutorial on Selection Sort;

Here is a good one on Insertion Sort.

There are 1000's of Youtube lectures on sorting algorithms: here is a creepy visualization of Insertion Sort, and here is a downright strange visualization of Insertion sort.

Here is a nice Youtube mini-lecture on sorting, with associated lectures on all the major sorting algorithms.

Lecture 5: PDF B&W: PDF    
6 R 2/4

Recursive sorting: Mergesort Recursive sorting: Quicksort;

Complexity analysis of recursive sorts

Here is a good Youtube video on Mergesort, and one on Quicksort.

The first video uses "Big Oh" notation O(...) instead of "Big Theta" notation, but they are basically the same.

There are several versions of quicksort, with subtle differences; the one above uses the exact method I will use in class, so please look at that one!

Lecture 6: PDF B&W: PDF


Part A Solution: HTML

Lab03: HTML
7 T 2/9


Object-Oriented Design; Java program structure; static vs non-static; breaking a program into separate files.

Please read "Classes and Objects" and "Java File Structure" in the Java text.

Look at Aaron Stevens' YouTube videos 30a, 30b, 30c.

Used the board!    
8 R 2/11

Quicksort reviewed; Complexity Analysis of Recursive Sorts;

Abstract data types; OOD and Java program structure continued.


Used the board and Dr. Java and finish the last part of Lecture 6 (see link above).

Here are examples similar to the code I demonstrated in class, for the three types of Java files:

Original Program with all code in one file: StackDemoOriginal.java

Now here is the same program, broken into the three kinds of files:


Part A Solutions: HTML

Lab04: HTML
  T 2/16 No class -- Monday schedule        
9 R 2/18

Stack, Queues, and Priority Queues; Ring Buffers.

Error handling using Exceptions.

Read the introduction to the Wiki articles on stacks: HTML and queues: HTML

Read the first half of the Wiki Article on Circular Buffers ("How it works" and look at the animated gif).

Read near the end of Chapter 2 in the Java book: "The Throw Statement" and "The Try/ Catch/Finally statement.

Lecture 9: PDF BW: PDF


Part A Solutions: HTML

Lab 05: HTML
10 T 2/23

References and pointers; fixing a problem with array data types: array resizing; introduction to Linked Lists.

Read the section on Reference Types (pp.74-81) CAREFULLY in the Java Text.

You might want to check out the classic Binky Pointer Fun video on YT, but bear in mind it is written for a different language (C or C++).

Used the board!    
11 R 2/25

Stacks and Queues with LLs.

Basics of List Processing: Iterative Algorithms

Notes on Iterative LL Algorithms

Here is a very short, clear tutorial on Linked Lists: YouTube There are a number of such tutorials on YouTube, so look around a bit for others if you wish!

Lecture 11: PDF BW: PDF


Part A Solutions: HTML

Lab 06: HTML
12 T 3/1

Iterative LL algorithms

  Used the board!   Last day to drop a class without a "W" on your transcript.
13 R 3/3 Recursive algorithms on LLs

  Notes on Recursion and LLs

Used the board!

No HW this week!

Here are some practice problems on Linked Lists: PDF

No Lab this week!

T 3/15

Recursive algorithms on LLs;

  Notes on Recursion and LLs

Used the board!    
  R 3/17 Midterm Exam  

Midterm Study Guide: HTML

Sample Midterm: PDF

Solution to Sample Midterm: PDF

Notes on Recursion in Java: HTML



Lab 07: HTML

15 T 3/22 Binary Trees, Binary Search Trees; Searching and Insertion in BSTs.


Lecture 15: PDF    
16 R 3/24 BSTs continued


Please read the following WikiP article on Tree Traversals: HTML and follow the link to read about breadth first search.

Lecture 16: Used the board!


Part A Solution: HTML

Lab 08: HTML

17 T 3/29 Deletion from BSTs; Recursive tree traversals; Iterative tree traversals using an explicit stack

Lecture 17: PDF



18 R 3/31 2-3 Trees; B-Trees and external data structures Here is a good explaination of 2-3 Tree Insertions: YT

Lecture 18: PDF



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


Part A Solution: HTML

Lab 09: HTML
19 T 4/5 Array representation of binary trees; Binary Heaps, Heapsort

There are many videos about binary heaps, here is a good one: YT



Used the board!




20 R 4/7 The (nearly) Perfect Data Structure; Perfect Hashing, Hash Functions; Hash Tables with Separate Chaining  

Used the board!

  Lab 10: HTML
21 T 4/12 Hash Tables with Linear Probing; Performance of Hash Tables HashTableLP.java Used the board!    
22 R 4/14 Discussion of Homework 09  

Used the board!



23 T 4/19 Game trees: adversary search; implementation issues; example Tic-Tac-Toe program Reading on AI Techniques for Game Playing: PDF

Lecture 23: PDF

BW Lecture: PDF



HW 10 (Part B is group project): HTML

Part A Solution:


24 R 4/21 Alpha-beta pruning and refinements to game-tree search Video on Alpha-beta Pruning: YT

Lecture 24: PDF


25 T 4/26 Graphs: Basic notions, graph traversals: depth first, breadth first  

Lecture 25: PDF

Here is the set of slides on State Space Search (optional, not required for final exam): PDF

Search for "undirected graph" on YouTube, if you want to see some lectures, there are 1000's!

Practice Problems on Graphs: HTML

26 R 4/28 Comments on Final Exam; Course Evaluations  


  T 5/3 Final Exam from 12:30 - 2:30        

Back to Top