1 CSC 427: Data Structures and Algorithm Analysis Fall 2006 Java Collections & List implementations  Collection classes: ─List (ArrayList, LinkedList),

Slides:



Advertisements
Similar presentations
Lists and the Collection Interface Chapter 4. Chapter Objectives To become familiar with the List interface To understand how to write an array-based.
Advertisements

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java From Control Structures through Data Structures by.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2006 Inheritance and efficiency  ArrayList  SortedArrayList  tradeoffs with adding/searching.
CSE 143 Lecture 22: Advanced List Implementation (ADTs; interfaces; abstract classes; inner classes; generics; iterators)
24-Jun-15 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
Fall 2007CS 2251 Lists and the Collection Interface Chapter 4.
© The McGraw-Hill Companies, 2006 Chapter 17 The Java Collections Framework.
Lists in Java Part of the Collections Framework. Kinds of Collections Collection --a group of objects, called elements –Set-- An unordered collection.
12-Jul-15 Lists in Java Part of the Collections Framework.
1 CSC 222: Computer Programming II Spring 2005 Searching and efficiency  sequential search  big-Oh, rate-of-growth  binary search  example: spell checker.
SEG4110 – Advanced Software Design and Reengineering TOPIC G Java Collections Framework.
1 CSC 321: Data Structures Fall 2012 Binary Search Trees  BST property  override binary tree methods: add, contains  search efficiency  balanced trees:
1 CSC 222: Object-Oriented Programming Spring 2013 Java interfaces & polymorphism  Comparable interface  defining an interface  implementing an interface.
Collections in Java. Kinds of Collections Collection --a group of objects, called elements –Set-- An unordered collection with no duplicates SortedSet.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
(c) University of Washington14-1 CSC 143 Java Collections.
1 CSC 222: Object-Oriented Programming Spring 2012 Object-oriented design  example: word frequencies w/ parallel lists  exception handling  System.out.format.
1 CSC 221: Computer Programming I Spring 2008 ArrayLists and arrays  example: letter frequencies  autoboxing/unboxing  ArrayLists vs. arrays  example:
Lists Ellen Walker CPSC 201 Data Structures Hiram College.
1 TCSS 143, Autumn 2004 Lecture Notes Java Collection Framework: Maps and Sets.
1/20/03A2-1 CS494 Interfaces and Collection in Java.
1 CSC 221: Computer Programming I Fall 2004 Lists, data access, and searching  ArrayList class  ArrayList methods: add, get, size, remove  example:
1 CSC 421: Algorithm Design and Analysis Spring /222/321 review  object-oriented design  cohesion, coupling  interfaces, inheritance, polymorphism.
3-February-2003cse Collections © 2003 University of Washington1 Java Collections CSE 403, Winter 2003 Software Engineering
(c) University of Washington15-1 CSC 143 Java List Implementation via Arrays Reading: 13.
CSE 143 Lecture 24 Advanced collection classes (ADTs; abstract classes; inner classes; generics; iterators) read 11.1, 9.6, , slides.
1 CSC 321: Data Structures Fall 2012 Lists, stacks & queues  Collection classes: ─List (ArrayList, LinkedList), Set (TreeSet, HashSet), Map (TreeMap,
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Chapter 13 Implementing.
(c) University of Washington16-1 CSC 143 Java Linked Lists Reading: Ch. 20.
(c) University of Washington16-1 CSC 143 Java Lists via Links Reading: Ch. 23.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2010 Java Collections & List implementations  Collection classes: ─List (ArrayList, LinkedList),
Collections Mrs. C. Furman April 21, Collection Classes ArrayList and LinkedList implements List HashSet implements Set TreeSet implements SortedSet.
1 TCSS 342, Winter 2005 Lecture Notes Linked List Implementation Weiss Ch. 6, pp Weiss Ch. 17, pp
© 2006 Pearson Addison-Wesley. All rights reserved5 B-1 Chapter 5 (continued) Linked Lists.
Course: Object Oriented Programming - Abstract Data Types Unit2: ADT ListsSlide Number 1 Principles for implementing ADTs ADT operations as “walls” between.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Thomas Kuehne.
1 CSC 321: Data Structures Fall 2012 Linked structures  nodes & recursive fields  singly-linked list  doubly-linked list  LinkedList implementation.
IMPLEMENTING ARRAYLIST COMP 103. RECAP  Comparator and Comparable  Brief look at Exceptions TODAY  Abstract Classes - but note that the details are.
Sets and Maps Part of the Collections Framework. 2 The Set interface A Set is unordered and has no duplicates Operations are exactly those for Collection.
CMSC 202 Containers and Iterators. Container Definition A “container” is a data structure whose purpose is to hold objects. Most languages support several.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
1 CSC 321: Data Structures Fall 2013 Lists, stacks & queues  Collection classes: ─List (ArrayList, LinkedList), Set (TreeSet, HashSet), Map (TreeMap,
CS 46B: Introduction to Data Structures July 21 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 18 List ADT Animated Version.
CSCS-200 Data Structure and Algorithms Lecture
Collections Dwight Deugo Nesa Matic
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Chapter 20 Ordered.
3-1 Java's Collection Framework Another use of polymorphism and interfaces Rick Mercer.
CSC 427: Data Structures and Algorithm Analysis
CSC 321: Data Structures Fall 2015 Hash tables HashSet & HashMap
CSC 321: Data Structures Fall 2016 Balanced and other trees
CSC 427: Data Structures and Algorithm Analysis
Linked Lists Chapter 5 (continued)
CSC 222: Object-Oriented Programming
CSC 321: Data Structures Fall 2016 Linked structures
CSC 222: Object-Oriented Programming Fall 2017
CSC 321: Data Structures Fall 2015 Binary Search Trees BST property
Implementing ArrayList Part 1
CSC 321: Data Structures Fall 2013 Linked structures
CSC 321: Data Structures Fall 2018 Linked structures
CSC 221: Computer Programming I Fall 2009
Computer Science and Engineering
CSC 321: Data Structures Fall 2018 Lists, stacks & queues
CSC 427: Data Structures and Algorithm Analysis
CSC 222: Object-Oriented Programming Spring 2013
Linked Lists Chapter 5 (continued)
CSC 143 Java Linked Lists.
CSC 222: Object-Oriented Programming Spring 2012
TCSS 143, Autumn 2004 Lecture Notes
CSC 321: Data Structures Fall 2018 Balanced and other trees
Presentation transcript:

1 CSC 427: Data Structures and Algorithm Analysis Fall 2006 Java Collections & List implementations  Collection classes: ─List (ArrayList, LinkedList), Set (TreeSet, HashSet), Map (TreeMap, HashMap)  ArrayList implementation  LinkedList implementation  iterators

2 Java Collection classes a collection is an object (i.e., data structure) that holds other objects the Java Collection Framework is a group of generic collections  defined using interfaces abstract classes, and inheritance

3 Sets & Maps java.util.Set interface: an unordered collection of items, with no duplicates public interface Set extends Collection { boolean add(E o);// adds o to this Set boolean remove(Object o);// removes o from this Set boolean contains(Object o);// returns true if o in this Set boolean isEmpty();// returns true if empty Set int size();// returns number of elements void clear();// removes all elements Iterator iterator();// returns iterator... } java.util.Map interface: a collection of key  value mappings public interface Map { boolean put(K key, V value);// adds key  value to Map V remove(Object key);// removes key  ? entry from Map V get(Object key);// returns true if o in this Set boolean containsKey(Object key); // returns true if key is stored boolean containsValue(Object value); // returns true if value is stored boolean isEmpty();// returns true if empty Set int size();// returns number of elements void clear();// removes all elements Set keySet();// returns set of all keys... } implemented by TreeSet & HashSet MORE LATER implemented by TreeMap & HashMap MORE LATER

4 Dictionary revisited note: our Dictionary class could have been implemented using a Set  the TreeSet implementation provides O(log N) add, remove, and contains  the HashSet implementation provides on average O(1) add, remove, and contains implementation details later import java.util.Set; import java.util.HashSet; import java.util.Scanner; import java.io.File; public class Dictionary { private Set words; public Dictionary() { this.words = new HashSet (); } public Dictionary(String filename) { this(); try { Scanner infile = new Scanner(new File(filename)); while (infile.hasNext()) { String nextWord = infile.next(); this.add(nextWord); } catch (java.io.FileNotFoundException e) { System.out.println("FILE NOT FOUND"); } public void add(String newWord) { this.words.add(newWord.toLowerCase()); } public void remove(String oldWord) { this.words.remove(oldWord.toLowerCase()); } public boolean contains(String testWord) { return this.words.contains(testWord.toLowerCase()); }

5 Word frequencies a variant of Dictionary is WordFreq  stores words & their frequencies (number of times they occur)  can represent the word  counter pairs in a Map implementation details later import java.util.Map; import java.util.TreeMap; import java.util.Scanner; import java.io.File; public class WordFreq { private Map words; public WordFreq() { words = new TreeMap (); } public WordFreq(String filename) { this(); try { Scanner infile = new Scanner(new File(filename)); while (infile.hasNext()) { String nextWord = infile.next(); this.add(nextWord); } catch (java.io.FileNotFoundException e) { System.out.println("FILE NOT FOUND"); } public void add(String newWord) { String cleanWord = newWord.toLowerCase(); if (words.containsKey(cleanWord)) { words.put(cleanWord, words.get(cleanWord)+1); } else { words.put(cleanWord, 1); } public void showAll() { for (String str : words.keySet()) { System.out.println(str + ": " + words.get(str)); }

6 ArrayList implementation recall: ArrayList implements the List interface  which is itself an extension of the Collection interface  underlying list structure is an array get(index), add(item), set(index, item)  O(1) add(index, item), indexOf(item), contains(item), remove(index), remove(item)  O(N)

7 ArrayList class structure the ArrayList class has as fields  the underlying array  number of items stored when constructing, can specify the intial capacity  capacity != size a default initial capacity is defined by a constant public class SimpleArrayList { private static final int INIT_SIZE = 10; private E[] items; private int numStored; public SimpleArrayList() { this(SimpleArrayList.INIT_SIZE); } public SimpleArrayList(int capacity) { this.items = (E[]) new Object[capacity]; this.numStored = 0; }... } interestingly: you can't create an array using a generic type this.items = new E[capacity]; // ILLEGAL can work around this by creating an array of Objects, then immediately casting to the generic array type

8 ArrayList: add the add method  throws an exception if the index is out of bounds  resizes the underlying array if full (i.e., numStored == capacity)  shifts elements to the right of the desired index  finally, inserts the new value and increments the count public void add(int index, E newItem) { this.rangeCheck(index, "ArrayList add()", this.numStored); if (this.numStored == this.items.length) { E[] temp = (E[]) new Object[2*this.items.length]; for (int i = 0; i < this.items.length; i++) { temp[i] = this.items[i]; } this.items = temp; } for (int i = this.numStored; i > index; i--) { this.items[i] = this.items[i-1]; } this.items[index] = newItem; this.numStored++; } private void rangeCheck(int index, String msg, int bound) { if (index bound) { throw new IndexOutOfBoundsException( "\n" + msg + ": index " + index + " out of bounds. Should be in the range 0 to " + bound); }

9 ArrayList: add, get, size, indexOf, contains other add method  calls add(index,item) to add at the end get method  checks the index bounds, then simply accesses the array size method  returns the item count indexOf method  performs a sequential search contains method  uses indexOf public boolean add(E newItem) { this.add(this.numStored, newItem); return true; } public E get(int index) { this.rangeCheck(index, "ArrayList get()", this.numStored-1); return items[index]; } public int size() { return this.numStored; } public int indexOf(E oldItem) { for (int i = 0; i < this.numStored; i++) { if (oldItem.equals(this.items[i])) { return i; } return -1; } public boolean contains(E oldItem) { return (this.indexOf(oldItem) >= 0); }

10 ArrayList: remove the remove method  checks the index bounds  then shifts items to the left and decrements the count  note: could shrink size if becomes ½ empty the other remove  calls indexOf to find the item, then calls remove(index) public void remove(int index) { this.rangeCheck(index, "ArrayList remove()", this.numStored-1); for (int i = index; i < this.numStored-1; i++) { this.items[i] = this.items[i+1]; } this.numStored--; } public boolean remove(E oldItem) { int index = this.indexOf(oldItem); if (index >= 0) { this.remove(index); return true; } return false; } could we do this more efficiently? do we care?

11 ArrayLists vs. LinkedLists to insert or remove an element at an interior location in an ArrayList requires shifting data  O(N) LinkedList is an alternative structure  stores elements in a sequence but allows for more efficient interior insertion/deletion  elements contain links that reference previous and successor elements in the list  if given a reference to an interior element, can reroute the links to insert/delete an element in O(1)

12 Singly-linked lists in CSC222, you worked with singly-linked lists  the list was made of Nodes, each of which stored data and a link to the next node in the list  can provide a constructor and methods for accessing and setting these two fields  a reference to the front of the list must be maintained front 654 public class Node { private E data; private Node next; public Node(E data, Node next) { this.data = data; this.next = next; } public E getData() { return this.data; } public Node getNext() { return this.next; } public void setData(E newData) { this.data = newData; } public void setNext(Node newNext) { this.next = newNext; }

13 Exercises to create an empty linked list: front = null; front 654 public class Node { private E data; private Node next; public Node(E data, Node next) { this.data = data; this.next = next; } public E getData() { return this.data; } public Node getNext() { return this.next; } public void setData(E newData) { this.data = newData; } public void setNext(Node newNext) { this.next = newNext; } remove from the front: front = front.getNext(); to add to the front: front = new Node(3, front);

14 Exercises get value stored in first node: front 654 public class Node { private E data; private Node next; public Node(E data, Node next) { this.data = data; this.next = next; } public E getData() { return this.data; } public Node getNext() { return this.next; } public void setData(E newData) { this.data = newData; } public void setNext(Node newNext) { this.next = newNext; } indexOf: add at end: add at index: remove: remove at index: get value in kth node:

15 LinkedList implementation we could implement the LinkedList class using a singly-linked list  however, the one-way links are limiting  to insert/delete from an interior location, really need a reference to the previous location e.g., remove(item) must traverse and keep reference to previous node, so that when the correct node is found, can route links from previous node  also, accessing the end requires traversing the entire list can handle this one special case by keeping a reference to the end as well front back

16 Doubly-linked lists a better, although more complicated solution, is to have bidirectional links front 654 back  to move forward or backward in a doubly ‑ linked list, use previous & next links  can start at either end when searching or accessing  insert and delete operations need to have only the reference to the node in question  big-Oh? add(item)add(index, item) get(index) set(index, item) indexOf(item)contains(item) remove(index)remove(item)

17 Exercises to create an empty list: front = null; back = null; public class DNode { private E data; private DNode previous; private DNode next; public DNode(E d, DNode p, DNode n) { this.data = d; this.previous = p; this.next = n; } public E getData() { return this.data; } public DNode getPrevious() { return this.previous; } public DNode getNext() { return this.next; } public void setData(E newData) { this.data = newData; } public void setPrevious(DNode newPrevious) { this.previous = newPrevious; } public void setNext(DNode newNext) { this.next = newNext; } remove from the front: front = front.getNext(); if (front == null) { back = null; } else { front.setPrevious(null); } to add to the front: front = new DNode(3, null, front); if (front.getNext() == null) { back = front; } else { front.getNext.setPrevious(front); }

18 Exercises public class DNode { private E data; private DNode previous; private DNode next; public DNode(E d, DNode p, DNode n) { this.data = d; this.previous = p; this.next = n; } public E getData() { return this.data; } public DNode getPrevious() { return this.previous; } public DNode getNext() { return this.next; } public void setData(E newData) { this.data = newData; } public void setPrevious(DNode newPrevious) { this.previous = newPrevious; } public void setNext(DNode newNext) { this.next = newNext; } get value stored in first node: indexOf: add at end: add at index: remove: remove at index: get value in kth node:

19 Dummy nodes every time you add/remove, you need to worry about updating front & back  if add at front/end of list, must also update end/front if previously empty  if remove from front/end of list, must update end/front if now empty the ends lead to many special cases in the code SOLUTION: add dummy nodes to both ends of the list  the dummy nodes store no actual values  instead, they hold the places so that the front & back never change  removes special case handling front null 5 back 46

20 Exercises to create an empty list (with dummy nodes): front = new DNode(null, null, null); back = new DNode(null, front, null); front.setNext(back); remove from the front: front.setNext(front.getNext().getNext()); front.getNext().setPrevious(front); front null 5 back 46 add at the front: front.setNext(new DNode(3, front, front.getNext()); front.getNext().getNext().setPrevious(front.getNext()); get value stored in first node: indexOf: add at end: add at index: remove: remove at index: get value in kth node:

21 LinkedList class structure the LinkedList class has an inner class  defines the DNode class fields store  reference to front and back dummy nodes  node count the constructor  creates the front & back dummy nodes  links them together  initializes the count public class SimpleLinkedList { private class DNode {... } private DNode front; private DNode back; private int numStored; public SimpleLinkedList() { this.front = new DNode(null, null, null); this.back = new DNode(null, front, null); this.front.setNext(this.back); this.numStored = 0; } front null back

22 LinkedList: add the add method  similarly, throws an exception if the index is out of bounds  calls the helper method getNode to find the insertion spot  note: getNode traverses from the closer end  finally, inserts a node with the new value and increments the count public void add(int index, E newItem) { this.rangeCheck(index, "ArrayList add()", this.numStored); DNode before = this.getNode(index-1); DNode after = before.getNext(); DNode newNode = new DNode (newItem, before, after); before.setNext(newNode); after.setPrevious(newNode); this.numStored++; } private DNode getNode(int index) { if (index <= this.numStored/2) { DNode stepper = this.front; for (int i = 0; i <= index; i++) { stepper = stepper.getNext(); } return stepper; } else { DNode stepper = this.back; for (int i = this.numStored-1; i >= index; i--) { stepper = stepper.getPrevious(); } return stepper; }

23 LinkedList: add, get, size, indexOf, contains other add method  calls add(index,item) to add at the end get method  checks the index bounds, then calls getNode size method  returns the item count indexOf method  performs a sequential search contains method  uses indexOf public boolean add(E newItem) { this.add(this.numStored, newItem); return true; } public E get(int index) { this.rangeCheck(index, "ArrayList get()", this.numStored-1); return this.getNode(index).getData(); } public int size() { return this.numStored; } public int indexOf(E oldItem) { DNode stepper = this.front.getNext(); for (int i = 0; i < this.numStored; i++) { if (oldItem.equals(stepper.getData())) { return i; } stepper = stepper.getNext(); } return -1; } public boolean contains(E oldItem) { return (this.indexOf(oldItem) >= 0); }

24 LinkedList: remove the remove method  checks the index bounds  then calls getNode & removes the node  decrements count the other remove  calls indexOf to find the item, then calls remove(index) public void remove(int index) { this.rangeCheck(index, "ArrayList remove()", this.numStored-1); DNode removeNode = this.getNode(index); removeNode.getPrevious().setNext(removeNode.getNext()); removeNode.getNext().setPrevious(removeNode.getPrevious()); this.numStored--; } public boolean remove(E oldItem) { int index = this.indexOf(oldItem); if (index >= 0) { this.remove(index); return true; } return false; } could we do this more efficiently? do we care?

25 Collections & iterators many algorithms are designed around the sequential traversal of a list  ArrayList and LinkedList implement the List interface, and so have get() and set()  ArrayList impementations of get() and set() are O(1)  however, LinkedList implementations are O(N) for (int i = 0; i < words.size(); i++) {// O(N) if ArrayList System.out.println(words.get(i));// O(N 2 ) if LinkedList } philosophy behind Java collections 1.a collection must define an efficient, general-purpose traversal mechanism 2.a collection should provide an iterator, that has methods for traversal 3.each collection class is responsible for implementing iterator methods

26 Iterator the java.util.Iterator interface defines the methods for an iterator interface Iterator { boolean hasNext();// returns true if items remaining E next();// returns next item in collection void remove();// removes last item accessed } any class that implements the Collection interface (e.g., List, Set, …) is required to provide an iterator() method that returns an iterator to that collection List words;... Iterator iter = words.iterator(); while (iter.hasNext()) { System.out.println(iter.next()); } both ArrayList and LinkedList implement their iterators efficiently, so O(N) for both

27 ArrayList iterator an ArrayList does not really need an iterator  get() and set() are already O(1) operations, so typical indexing loop suffices  provided for uniformity ( java.util.Collections methods require iterable classes) to implement an iterator, need to define a new class that can  access the underlying array (  must be inner class to have access to private fields)  keep track of which location in the array is "next" "foo""bar""biz""baz""boo""zoo" nextIndex0

28 SimpleArrayList iterator java.lang.Iterable interface declares that the class has an iterator inner class defines an Iterator class for this particular collection (accessing the appropriate fields & methods) the iterator() method creates and returns an object of that class public class SimpleArrayList implement Iterable {... private class ArrayIterator implements Iterator { private int nextIndex; public SimpleIterator() { this.nextIndex = 0; } public boolean hasNext() { return this.nextIndex < SimpleArrayList.this.size(); } public E next() { this.nextIndex++; return SimpleArrayList.this.get(nextIndex-1); } public void remove() { if (this.nextIndex <= 0) { throw new RuntimeException("Must call next()"+ " before calling remove()"); } SimpleArrayList.this.remove(this.nextIndex-1); } public Iterator iterator() { return new ArrayIterator(); }

29 Iterators & the enhanced for loop given an iterator, collection traversal is easy and uniform SimpleArrayList words;... Iterator iter = words.iterator(); while (iter.hasNext()) { System.out.println(iter.next()); } as long as the class implements Iterable and provides an iterator() method, the enhanced for loop can also be applied SimpleArrayList words;... for (String str : words) { System.out.println(str); }

30 LinkedList iterator a LinkedList does need an iterator to allow for efficient traversals & list processing  get() and set() are already O(N) operations, so a typical indexing loop is O(N 2 ) again, to implement an iterator, need to define a new class that can  access the underlying doubly-linked list  keep track of which node in the list is "next" front null 5 back 46 nextNode

31 SimpleLinkedList iterator again, the class implements the Iterable interface inner class defines an Iterator class for this particular collection iterator() method creates and returns an object of that type public class SimpleLinkedList implement Iterable {... private class LinkedIterator implements Iterator { private DNode nextNode; public LinkedIterator() { this.nextNode = SimpleLinkedList.this.front.getNext(); } public boolean hasNext() { return this.nextNode != SimpleLinkedList.this.back ; } public E next() { this.nextNode = this.nextNode.getNext(); return this.nextNode.getPrevious().getData(); } public void remove() { if (this.nextNode==SimpleLinkedList.this.front.getNext()) { throw new RuntimeException("Must call next()"+ " before calling remove()"); } this.nextNode.setPrevious( this.nextNode.getPrevious().getPrevious()); this.nextNode.getPrevious().setNext(this.nextNode); SimpleLinkedList.this.numStored--; } public Iterator iterator() { return new LinkedIterator(); }

32 Iterator vs. ListIterator java.util.Iterator defines methods for traversing a collection an extension, java.util.ListIterator, defines additional methods for traversing lists

33 TEST 1 will contain a mixture of question types, to assess different kinds of knowledge  quick-and-dirty, factual knowledge e.g., TRUE/FALSE, multiple choice similar to questions on quizzes  conceptual understanding e.g., short answer, explain code similar to quizzes, possibly deeper  practical knowledge & programming skills trace/analyze/modify/augment code either similar to homework exercises or somewhat simpler the test will contain several "extra" points e.g., 52 or 53 points available, but graded on a scale of 50 (hey, mistakes happen ) study advice:  see review sheet for outline of topicsreview sheet  review lecture notes (if not mentioned in notes, will not be on test)  read text to augment conceptual understanding, see more examples  review quizzes and homeworks  feel free to review other sources (lots of Java/algorithms tutorials online)