CMPSCI 187 Corner & Wang
Name:
Discussion 2 - Debugging, JUnit Test
1 Feb 2016
Spire ID:
Debugging and writing JUnit Tests
The goal of this assignment is to get practice with debugging and writing JUnit Tests.
Debugging is the process of locating and fixi
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #9
John Ridgway
February 26, 2015
1
Recursive Denitions, Algorithms, and Programs
Recursion in General
In mathematics and computer science we often have denitions of concepts
that refer to t
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #7
John Ridgway
February 19, 2015
1
Generic Collections
Collection Elements
A stack is an example of a collection. Most common data structures are
collections.
A collection usually holds a
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #13, Concurrency, Interference, and Synchronization
John Ridgway
March 12, 2015
Concurrency and Threads
Computers are capable of doing more than one thing at the same time.
Some computer h
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #16, Binary Search Trees
John Ridgway
March 31, 2015
1
Trees
Why Binary Search Trees?
Weve seen that binary search is a powerful technique to search sorted
arrays, nding an element in O(log
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #14, Lists: The Abstraction and Array Implementation
John Ridgway
March 24, 2015
1
Comparing Objects in Java
Comparing Objects in Java
We are going to look at lists, one of the most general
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #17, Implementing Binary Search Trees
John Ridgway
April 2, 2015
1
Implementing Binary Search Trees
Review: The BST Interface
Binary search trees store objects in nodes, arranged according
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #19, Heaps and Priority Queues
John Ridgway
April 9, 2015
1
Heaps
Review: The Idea of a Heap
A heap is a data structure that keeps some comparable elements in a
semi-sorted state.
The larg
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #18, Using Binary Search Trees
John Ridgway
April 7, 2015
1
Using Binary Search Trees
Review: Balancing a BST
As weve discussed, nding an element in a binary search tree takes worstcase tim
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #20, Introduction to Graphs
John Ridgway
April 14, 2015
1
Introduction to Graphs
Graphs and their Vocabulary
Linear lists and trees are two ways to make objects out of nodes and
connections
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #21, Searching in Graphs
John Ridgway
April 16, 2015
1
Errata
Errors in Balancing a Binary Search Tree
The code given in DJW to balance a binary search tree works well in the
absence of dup
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #22, More Graph Searches, Some Sorting, and Ecient Sorting
Algorithms
John Ridgway
April 21, 2015
1
Review of Uniform-cost Search
Uniform-Cost Search
This method from DJW makes a priority q
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #23, More Sorting Algorithms
John Ridgway
April 23, 2015
1
Ecient Sorting Algorithms
Merge Sort Review
Code for mergeSort
void mergeSort ( int first , int last ) cfw_
if ( first < last ) cfw
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #12
John Ridgway
March 10, 2015
1
Implementations of Queues
1.1
Linked Queues
A Linked Queue
Implementing a queue with a linked list is very natural. We keep head and
tail pointers, enqueue
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #11
John Ridgway
March 5, 2015
1
More on Recursion
Recursion and Explicit Stacks
Recall the recursive markBlob method from last lecture. To mark all the
land squares reachable from (x, y),
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #10
John Ridgway
March 3, 2015
Review of the Grid Class
DJW present a class called Grid in Section 4.4. A Grid object has a
two-dimensional array of booleans, called grid.
We, though not D
Programming with
Data Structures
CMPSCI 187
Fall 2016
Please find a seat
Try not to leave empty seats (the room will be pretty full!)
Turn off or silence your mobile phone
Turn off your other internet-enabled devices
1
Todays class
Overview of course topi
Programming with
Data Structures
CMPSCI 187
Fall 2016
Please find a seat
Try to sit close to the center (the room will be pretty full!)
Turn off or silence your mobile phone
Turn off your other internet-enabled devices
1
Reminders
Read course webpage.
Ma
Programming with
Data Structures
CMPSCI 187
Fall 2016
Please find a seat
Try to sit close to the center (the room will be pretty full!)
Turn off or silence your mobile phone
Turn off your other internet-enabled devices
1
Reminders
Read course webpage.
Ma
Programming with
Data Structures
CMPSCI 187
Fall 2016
Please find a seat
Try to sit close to the center (the room will be pretty full!)
Turn off or silence your mobile phone
Turn off your other internet-enabled devices
1
Reminders
Read course webpage.
Ma
Programming with
Data Structures
CMPSCI 187
Fall 2016
Please find a seat
Try to sit close to the center (the room will be pretty full!)
Turn off or silence your mobile phone
Turn off your other internet-enabled devices
1
Reminders
Assignment 3 is due thi
CMPSCI 187 Midterm 1 (Feb 17, 2016)
Instructions:
This is a closed book, closed notes exam. You have 120 minutes to
complete the exam.
The exam has 10 pages printed on double sides. Be sure to check both
sides of each paper.
Please write down your name
Programming with
Data Structures
CMPSCI 187
Fall 2016
Please find a seat
Try to sit close to the center (the room will be pretty full!)
Turn off or silence your mobile phone
Turn off your other internet-enabled devices
1
Todays topics
The Stack Data Stru
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #1
John Ridgway
January 20, 2015
Contents
1 Introduction
1
2 Administrative Stu
1
3 Software Engineering
2
1
Introduction
About the Course
What is CmpSci 187?
Programming Maturity?
Data S
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #4
John Ridgway
February 5, 2015
1
Abstract Data Types
Abstract Data Types (ADTs)
Abstraction.
Information hiding.
Data abstraction.
We deal with data at three dierent levels: applicatio
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #6
John Ridgway
February 12, 2015
Administrivia
Collect papers for discussions 2 and 3.
First exam Feb 19 at 7:00pm in Marcus 131. If you cant do it then
(documented excuse) let me know TO
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #2
John Ridgway
January 22, 2015
1
Administrivia
Administrivia
Clickers
Lecture shopping
Exam schedule: February 19, March 25, April 23, evenings!
2
Last thoughts on Software Engineering
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #5
John Ridgway
February 10, 2015
Administrivia
No discussion: homework posted instead
First exam Feb 19 at 7:00pm in Marcus 131.
Grades on Moodle
Assignment 02 due Thursday due at 8:30
CmpSci 187: Programming with Data Structures
Spring 2015
Lecture #8
John Ridgway
February 24, 2015
1
Postx Arithmetic
Arithmetic Notations
You are used to inx notation for arithmetic expressions, e.g., 2 (3 + 7).
Alternative notations exist; we could us