CSC 212 – Data Structures Lecture 37: Course Review.

Slides:



Advertisements
Similar presentations
Chapter 22 Implementing lists: linked implementations.
Advertisements

Lecture 22, Revision 1 Lecture notes Java code – CodeFromLectures folder* Example class sheets – 4 of these plus solutions Extra examples (quicksort) Lab.
Lists and the Collection Interface Chapter 4. Chapter Objectives To become familiar with the List interface To understand how to write an array-based.
CSC 212 – Data Structures Lecture 22: PositionList.
CHAPTER 4 Queues. Queue  The queue, like the stack, is a widely used data structure  A queue differs from a stack in one important way  A stack is.
CHAPTER 4 Queues MIDTERM THURSDAY, OCTOBER 17 IN LAB.
CSC 212 – Data Structures.  Fri., Dec. 17 th from 8AM – 10AM in OM 200  Plan on exam taking full 2 hours  If major problem, come talk to me ASAP 
© 2004 Goodrich, Tamassia Hash Tables1  
1 CSC 421: Algorithm Design & Analysis Spring 2013 See online syllabus: (also on BlueLine2) Course.
Lists and Iterators CSC311: Data Structures 1 Chapter 6 Lists and Iterators Objectives Array Lists and Vectors: ADT and Implementation Node Lists: ADT.
CS 307 Fundamentals of Computer Science 1 Abstract Data Types many slides taken from Mike Scott, UT Austin.
CSC 212 Vectors, Lists, & Sequences. Announcement Daily quizzes accepted electronically only  Submit via one or other Dropbox  also accepted,
Fall 2007CS 2251 Iterators and Tree Traversals. Fall 2007CS 2252 Binary Trees In a binary tree, each node has at most two subtrees A set of nodes T is.
Hash Tables1 Part E Hash Tables  
CSC 212 – Data Structures Prof. Matthew Hertz WTC 207D /
Hash Tables1 Part E Hash Tables  
Lists and the Collection Interface Chapter 4. Chapter 4: Lists and the Collection Interface2 Chapter Objectives To become familiar with the List interface.
Fall 2007CS 2251 Lists and the Collection Interface Chapter 4.
Hash Tables1 Part E Hash Tables  
Basic Definitions Data Structures: Data Structures: A data structure is a systematic way of organizing and accessing data. Or, It’s the logical relationship.
COMPSCI 125 Spring 2005 ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Odds and Ends Strings (from Chapter 9) StringTokenizer.
Cmp Sci 187: Midterm Review Based on Lecture Notes.
CSC 212 – Data Structures Lecture 21: IndexList a/k/a Vector, ArrayList.
Rossella Lau Lecture 1, DCO20105, Semester A, DCO Data structures and algorithms  Lecture 1: Introduction What this course is about:  Data.
COSC 2007 Data Structures II
Problem Of The Day  Decipher the following phrase: STANDS 0 _
Chapter 3 List Stacks and Queues. Data Structures Data structure is a representation of data and the operations allowed on that data. Data structure is.
Data Structures and Abstract Data Types "Get your data structures correct first, and the rest of the program will write itself." - David Jones.
CSCA48 Course Summary.
Introduction. 2COMPSCI Computer Science Fundamentals.
LECTURE 37: ORDERED DICTIONARY CSC 212 – Data Structures.
Chapter 12 Recursion, Complexity, and Searching and Sorting
Data structures and algorithms in the collection framework 1 Part 2.
© 2004 Goodrich, Tamassia Stacks. © 2004 Goodrich, Tamassia Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data.
Data Design and Implementation. Definitions of Java TYPES Atomic or primitive type A data type whose elements are single, non-decomposable data items.
Hash Tables1   © 2010 Goodrich, Tamassia.
1 Symbol Tables The symbol table contains information about –variables –functions –class names –type names –temporary variables –etc.
30 May Stacks (5.1) CSE 2011 Winter Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An.
CSC 212 – Data Structures.  Fri., Dec. 14 th from 2:45 – 4:45PM in SH1028  Plan on exam taking full 2 hours  If major problem, come talk to me ASAP.
© 2004 Goodrich, Tamassia Hash Tables1  
CSE 143 Lecture 24 Advanced collection classes (ADTs; abstract classes; inner classes; generics; iterators) read 11.1, 9.6, , slides.
CSC 212 – Data Structures Lecture 17: Stacks. Question of the Day Move one matchstick to produce a square.
Final Exam Review CS Total Points – 60 Points Writing Programs – 50 Points Tracing Algorithms, determining results, and drawing pictures – 50.
CSC 212 – Data Structures Lecture 26: Hash Tables.
Problem of the Day  Simplify this equation: (x - a) * (x - b) * (x - c) * … * (x - z)
CSS446 Spring 2014 Nan Wang.  To understand the implementation of linked lists and array lists  To analyze the efficiency of fundamental operations.
Building Java Programs Bonus Slides Hashing. 2 Recall: ADTs (11.1) abstract data type (ADT): A specification of a collection of data and the operations.
CS1020 Data Structures and Algorithms I Lecture Note #14
CSC 212 – Data Structures Lecture 23: Iterators. Question of the Day Thieves guild states it will sell to members: lock picking kits  $0.67 each 40’
CSC 212 Sequences & Iterators. Announcements Midterm in one week  Will cover through chapter 5 of book  Midterm will be open book, open note (but, closed.
CSC 212 – Data Structures.  Tues., Dec. 10 th from 8:00 – 10:ooAM in OM220  Plan on exam taking full 2 hours  If major problem, come talk to me ASAP.
Introduction to Objects and Encapsulation Computer Science 4 Mr. Gerb Reference: Objective: Understand Encapsulation and abstract data types.
 Saturday, April 20, 8:30-11:00am in B9201  Similar in style to written midterm exam  May include (a little) coding on paper  About 1.5 times as long.
CSC Programming for Science Lecture 37 : Course Review.
CS 367 Introduction to Data Structures Charles N. Fischer Fall s367.html.
Final Exam Review CS Total Points – 20 Points Writing Programs – 65 Points Tracing Algorithms, determining results, and drawing pictures – 50.
1 Resolving Collision Although collisions should be avoided as much as possible, they are inevitable Need a strategy for resolving collisions. We look.
Problem of the Day  Simplify this equation: (x - a) * (x - b) * (x - c) * … * (x - z)
1 Welcome Alireza Humber College Lecture 1 Game 540 Alireza
CSC 212 – Data Structures Lecture 28: More Hash and Dictionaries.
COMP 103 Course Review. 2 Menu  A final word on hash collisions in Open Addressing / Probing  Course Summary  What we have covered  What you should.
Final Exam Review CS 3358.
Sequences and Iterators
Exam Hints.
Lecture 15: More Iterators
structures and their relationships." - Linus Torvalds
Final Exam Review COP4530.
CS210- Lecture 16 July 11, 2005 Agenda Maps and Dictionaries Map ADT
structures and their relationships." - Linus Torvalds
Presentation transcript:

CSC 212 – Data Structures Lecture 37: Course Review

Final Exam Friday, Dec. 15 from 3:15 – 5:15 in OM 205 Plan for exam to take full 2 hours  Talk to me if this is a major problem Exam covers material from entire semester  Format like 2 midterms  Still open-book, open-note, closed-computer

Design computational solutions  Decompose a problem into logically grouped subprograms  Develop and analyze algorithms Program well  Code in a high-level language  Debug a program  Write and use a test plan  Document a program  Work independently Organize data for effective use  Use fundamental data structures  Implement data structures Understand the role of computing and the computer professional  Present or explain ideas  Weigh different solutions and explain or argue why one was preferable Objectives Met in CSC212 Design computational solutions  Decompose a problem into logically grouped subprograms  Develop and analyze algorithms Program well  Code in a high-level language  Debug a program  Write and use a test plan  Document a program  Work independently Organize data for effective use  Use fundamental data structures  Implement data structures Understand the role of computing and the computer professional  Present or explain ideas  Weigh different solutions and explain or argue why one was preferable

What Gets Inherited and How All fields & methods (members) inherited  Public members accessed as if declared in subclass (but they should not be!)  Private members cannot be accessed  Protected members used as if subclass declared them as private (but, do not do this!) Subclasses can override/overload method  Call method defined for instance’s type Subclasses can hide field  Use the field defined for variable’s type

Exceptions in Java Throw exception when problem detected  Must instantiate instance before throwing Handle by catching exception  Only catch exceptions you want to handle Method lists exceptions thrown via throws  Include any exception not caught  Does not matter if method was originator

Abstract methods cannot have a body  IOU that subclasses will define the method Class with abstract methods is abstract  Cannot be instantiated, but can be extended  Can have fields & methods Interface declares abstract methods  All methods are public abstract methods Abstract Methods

Arrays vs. Linked Lists Two alternate ways to hold data  Not ADTs, but specific implementations Arrays generally offer quick access times, but hard to maintain and resize Linked lists offer flexible sizing, but access times can be slow  Can be singly, doubly, or circularly linked

Queues, Stacks, & Deques Offer simple means of tracking elements  Like a line, Queues are first-in, first-out  Stacks are last-in, first-out  Deques can be accessed from either end Cannot access interior elements  No way of searching for an element either Implemented with either array or linked list  Arrays can violate unlimited space guarantee

Iterators & Iterables Important interfaces defined by Java: import java.util.Iterator; import java.lang.Iterable; public interface Iterator { E next(); boolean hasNext() throws NoSuchElementException; void remove() throws UnsupportedOperationException; } public interface Iterable { Iterator iterator(); }

More Iterator & Iterable Use Iterator to abstract processing Iterator it;... for (it = myList.iterator(); it.hasNext(); ) { Integer i = it.next();... } Process Iterable objects in an even easier way... for (Integer i : myList) {... }

Lists List is Iterable collection of elements  Can now access any element in collection  Different lists provide other accessor methods IndexList access using 0-based ranks  Not the same as array -- ranks can change PositionList access via relative position  Relies on Position ADT to hold elements Sequence combines two lists & Deque

How Computer Normally Works I’ll have a Manhattan No problem. That’ll be $2 billion

Working With Map & Dictionary I’ll have a Manhattan No problem. That’ll be $2 billion key value

Maps & Dictionaries Rely on Entry ADT -- key & value pair Maps have at most 1 Entry with any key  New Entry replaces previous Entry with key  Remove Entry by specifying its key Entrys in Dictionary can share key  New Entry does not affect others with that key  Remove Entry by specifying key AND value

Map & Dictionary Implementation Many possible implementations possible  Sequence with elements kept in sorted order  Sequence with elements kept in unsorted order  Hash Table (which is not an ADT) Hash table stores all of the Entrys  Hash function uses key to compute integer from 0 to size of table - 1  Goal is storing entry (k, v) at index h(k)

Collisions When implemented with hash table & two Keys share hash code Three commonly used handling schemes  Separate chaining: table contains Lists of entries hashed to that index  Linear probing: loop through array looking for first open array location  Double hashing: plug key into another hash function to find empty array location

Sets & Partitions Sets implement at least three operations  intersect, union, & subtract  Constructor others depend on how Set used Set’s operations rely on instances of subclasses of Merge Partition is first use of Set  Instances hold collection of disjoint Sets  Set’s constructor must take single element

Quick-Select & Pattern Matching Quick-Select finds n th element in Sequence  Uses divide-and-conquer for speed  Honestly, not a lot to ask about it Know the pattern matching algorithms  When & why we may want to use one over the others  Also know how to perform their actions -- mostly “trained monkey” work

Hints for Studying The exam will NOT require:  Memorizing ADT’s methods  Memorizing Node implementations  Memorizing big-Oh time proofs  (Recursion) The exam WILL require:  Knowing what the methods do  Be able to implement the methods  Computing big-Oh time complexity

Studying For the Exam 1. What does the ADT do? What are real-world analogues for it? 2. How is the ADT used? What applications use this ADT? How do they use it and why? 3. Can you explain examples’ answers? Keep reviewing material until you can do this cold 4. How do we implement the ADT? Why is it implemented in that way? What are the performance tradeoffs?

Before Next Lecture… CSC212 Final Exam: Fri., Dec. 15 from 3:15–5:15 in OM 205 Bring 1 (or more) pencils to the exam Do well on all your finals Have a good Christmas break Get ready for new term of challenges & fun