Computer Science 210
Data Structures
Fall 2016, Siena College
Class Examples
Class examples will be linked below. Please report any missing examples.
- Java Review
-
- Late - Late penalty calculator
- GradeRangeCounter - arrays, including static initializers
- BaaBaaBad - motivating example for methods
- BaaBaaBetter - defining a static method
- BaaBaa2Methods - 2 methods
- NumberInfo - a method that takes a parameter
- HoursWorked - passing a String to a method, and using a Scanner to break it into components
- HoursWorked2 - same example, but pass in the Scanner as a parameter
- SumOfSquares - a method that takes two parameters
- Sum1ToN - a method that returns a value
- Sum1ToNBetter - a better version of the previous method
- Distance - a method that computes the distance between two points in the plane
- GradingBreakdown - a longer program that reads lots of inputs, just screaming out for a method to help organize
- GradingBreakdownBetter - the same program with a method introduced to organize the code better
- Classes
-
- RatiosNoClass - a motivating example without classes
- Ratios - a first look at a custom class
- PurchaseTracker - a custom class and a class variable
- DoublePair - a general purpose class that holds a pair of double values
- ObjectPair - a general purpose class that holds a pair of Object values
- GenericPair - a generic pair class using Java generics (type parameters)
- The ArrayList/Vector
-
- Two Dimensional Arrays
-
- Matrix2D - a two-dimensional matrix class with
some basic methods
- Complexity and Asymptotic Analysis
-
- Recursive Methods
-
- Sum1ToNRec - a recursive method to compute a
mathematical formula
- Powers - compute powers (base raised to an
exponent) iteratively and recursively
- Searching and Sorting
-
- Linked Structures
-
- Iterators
-
- Linear Structures
-
- MazeRunner - Bailey example showing
stacks and queues, slightly enhanced
- Trees
-
- Maps and Hashing
-