CSE 1030: Data Structure Mark Shtern
Written Test Different exam (>9) Wrong Exam Strategy (> 10) Q1 No auto generate id (>13) Static is missing (>12) No super (>6) No extend (>7) Public/Private
Written Test Q2 Alias Deep and Shallow copy (> 20%) (Book: pages 313, 822) Q3 Wrong signature (>12) (idea on page 663) Q4
Data Structure Stack is a last in, first out Push, pop Queue (FIFO) is collection in which the entities in the collection are kept in order enqueue: addition of entities to the rear terminal position dequeue removal of entities from the front terminal position Set FIFO is acronyms for First In, First Out
Example 01 Implement a set collection using LinkedList
Example 02 Implement a queue collection using LinkedList
Example 03 Implement a stack collection using LinkedList
Course Review
Concepts Client vs. Implementer Development cycle UML Delegation Performance
Classes Methods Attributes Constructor Public/Private Class vs Object Copy constructor, constructor chaining, super Public/Private Class vs Object Interclass Abstract class Generics Javadoc Archietcture
Object State Reference Accessors and Mutators Immutable equals/ hashCode, compareTo and toString Clone vs copy constructor Object vs utility this Inheritance
Methods Parameters Return Precondition/Postcondition Exceptions Reuse code, code duplication Initialize Parameters Attribute shadowing vs overload vs override Early and late binding Static Final
Attribute Primitive type Non primitive type Static Final Attribute Privacy Attribute caching
Patterns Invocation counter Stamping a serial number Singleton Model-View-Controller
Interface Methods Constants Examples Serializable Cloneable Comparable
Aggregation and Composition Copy Alias, shallow, Deep Collections Obligatory methods
Storage Collections Data Structure Arrays Traversal Map, Set, List Stack, Queue, LinkedList Arrays Traversal Index, iterators
Validation Exceptions Error codes Friendly/Message Error handling Checked, unchecked try, catch, throw, handling multiple exceptions Error codes Friendly/Message Error handling Assertion Defensive programming
Recursion Loops vs Recursion Base cases Recursive cases
Steps to Class Implementation Write skeleton contains fields and methods required by API Write test harness that tests every feature of the class Identify private attribute and declare them Implement constructors, accessors, mutators, methods Avoid redundancy by delegating and defining private methods Add new test cases as you implement methods