



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of the cs200 class offered in fall 2009, including the class structure, differences from previous courses, grading policies, and course goals. Topics covered include algorithms, data structures, complexity analysis, abstract data types, and implementing adts using java.
Typology: Lab Reports
1 / 5
This page cannot be seen from the preview
Don't miss anything!




CS200 - Class Overview 1
CS200 - Class Overview 2
CS200 - Class Overview 3
CS200 - Class Overview 4
CS200 - Class Overview 5 Grading Programming assignments 30% Written assignments 10% Quizzes 10% Recitation (attendance + completion) 5% Midterms (2) 20% Final 25% You need to have a passing grade on the exams to get a passing grade in the course CS200 - Class Overview 6 Policies “Trust men and they will be true to you; treat them greatly and they will show themselves great.” Ralph Waldo Emerson Be professional. We are all here to learn. CS200 - Class Overview 7 Course Goals
Logical view Program = Algorithms + Data Structures Understand their relationship and use them correctly, efficiently Implementation Program = Objects + Methods Practice design and implementation of object-oriented programs in Java Analysis Study the complexity of programs, deriving Order of Magnitude expressions for their time and space use CS200 - Class Overview 8 Course Goals An understanding of a variety of common data structures A practical understanding of where they are applicable
Implementing ADTs Interface : Java construct that specifies method headers, constants What does it mean to implement an interface? How do you express it? Which interfaces did you meet in cs161? Which interface does an ArrayList implement? Do you remember some methods? CS200 - Class Overview 13 CS200 - Class Overview 14 ADT for a List
CS200 - Class Overview 15 ADT for a List, e.g. … Create
Add
Remove
Ask
Let’s play CS200 - Class Overview 16 Specifying ADT Describe: Methods that are visible (public)
CS200 - Class Overview 17 Specifications: example
CS200 - Class Overview 18 Specifications example (cont.)
// Removes the item at position index, if 1<=index<=size(). // After removal, elements with position >= index are // renumbered to position-1. // Throws an exception when index is out of range or // list is empty.
// Returns the item at position index if 1<=index<=size(). // List is not changed. // Throws an exception if index is out of range. CS200 - Class Overview 19 An Array Based Implementation Public class ListArrayBased implements ListInterface { private static final int MAX_LIST = 50; private Object items[]; private int numItems; public ListArrayBased() { items = new Object[MAX_LIST]; numItems = 0; } public boolean isEmpty() { return (numItems == 0); } CS200 - Class Overview 20 Implementation (cont) public int size() { return numItems; } public void removeAll() { items = new Object[MAX_LIST]; numItems = 0; } public Object get (int index) throws ListIndexOutOfBoundsException { if (index >=1 && index <= numItems) { return items[index - 1]; } else { // index out of range throw new ListIndexOutofBoundsException(); } }