Computer Science 112 Spring 2015
Gregory M. Kapfhammer
Introduction to Computer Science II
Keep in touch!Office Hours, Email, Web, Twitter
Arrays
Index
Element
Capacity
Fixed Size
Challenges?
Out of Bounds
Alternatives?
Linked Lists
Nodes
Singly linked list
Head
Tail
Arrays versus Linked Lists
Insertion
addLast
addFirst
Worst Case Time Complexity?
Deletion
removeFirst
removeLast
Worst Case Time Complexity?
Searching for an item
Worst Case Time Complexity?
Doubly linked list
Trade-offs?
Stacks
push
pop
top
Implementation Choices!
Arrays versus Linked Lists
java.util.Stack
git pull
StackExample.java
Explain the output
Matching Syntactic Elements
How does GVim handle this?
Can we implement this feature?
MatchParens.java is incomplete
Count off by threes
Develop examples of matching parentheses
Develop examples of non-matching parentheses
Use these as test inputs!
This program is incomplete!
Enhance the program in your team
What is your solution?
git pull
ArrayStack
:Ant compile
ant compile
:Ant ArrayStack
ant ArrayStack
Check the Output!
Exception Handling
Why?
git pull
NodeStack
:Ant compile
ant compile
:Ant NodeStack
ant NodeStack
Check the Output!
Differences in Exceptions
Why?
Queue
Nodes
Double-Ended Queue
Differences?
Let's try it!
Compile
Run
Enhance
toString
Link Hopping?