slides created by Marty Stepp

Slides:



Advertisements
Similar presentations
Java Review Interface, Casting, Generics, Iterator.
Advertisements

CSE 143 Lecture 22: Advanced List Implementation (ADTs; interfaces; abstract classes; inner classes; generics; iterators)
What Data Do We Have? Sections 2.2, 2.5 August 29, 2008.
CS180 Review Questions. Administriva Final Exam –Friday 8am MTHW 210 –No GUI programming question –Format 35 multiple choice questions 4 programming.
Topic R3 – Review for the Final Exam. CISC 105 – Review for the Final Exam Exam Date & Time and Exam Format The final exam is 120-minutes, closed- book,
Cmp Sci 187: Midterm Review Based on Lecture Notes.
CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++
Midterm Test Overview CS221 – 3/23/09. Test Curve Current median is a 71 or C- Median will be adjusted to an 81 or B- All test scores will be +10 on.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Custom Templatized Data Structures.
Introduction. 2COMPSCI Computer Science Fundamentals.
Course A201: Introduction to Programming 11/04/2010.
Data Structures and Java CS 105. L7: Java Slide 2 Data structure Data structure defined: A systematic way of organizing and accessing data Examples Dictionary:
1 Java: AP Curriculum Focus and Java Subset Alyce Brady.
CS 206 Introduction to Computer Science II 09 / 10 / 2009 Instructor: Michael Eckmann.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
Binary Search Trees Nilanjan Banerjee. 2 Goal of today’s lecture Learn about Binary Search Trees Discuss the first midterm.
LECTURE 9: INTERFACES & ABSTRACT CLASSES CSC 212 – Data Structures.
CSE 143 Lecture 10 Linked List Basics reading: slides created by Marty Stepp
CSE 143 Lecture 24 Advanced collection classes (ADTs; abstract classes; inner classes; generics; iterators) read 11.1, 9.6, , slides.
Slide 1 Linked Data Structures. Slide 2 Learning Objectives  Nodes and Linked Lists  Creating, searching  Linked List Applications  Stacks, queues.
CS342 Data Structures End-of-semester Review S2002.
Copyright © 2002 Pearson Education, Inc. Slide 1.
CIS Intro to JAVA Lecture Notes Set July-05 GUI Programming – Home and reload buttons for the webbrowser, Applets.
The assignment expressions. The assignment operator in an assignment statement We have seen the assignment statement: Effect: var = expr; Stores the value.
Recitation 5 Enums and The Java Collections classes/interfaces 1.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
Introduction to Collections. Collections Collections provide a way of organizing related data in a model Different types of collections have different.
Manipulator example #include int main (void) { double x = ; streamsize prec = cout.precision(); cout
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
1 Queues (Continued) Queue ADT Linked queue implementation Array queue implementation Circular array queue implementation Deque Reading L&C , 9.3.
slides adapted from Marty Stepp and Hélène Martin
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
CSE 373 Implementing a Stack/Queue as a Linked List
CS 215 Final Review Ismail abumuhfouz Fall 2014.
Midterm Review.
Building Java Programs
Week 3 - Friday CS221.
Week 15 – Monday CS221.
slides created by Marty Stepp
Top Ten Words that Almost Rhyme with “Peas”
Stack Lesson xx   This module shows you the basic elements of a type of linked list called a stack.
CSE 143 Lecture 9 References and Linked Nodes reading: 3.3; 16.1
Building Java Programs
CSE 143 Lecture 9 References and Linked Nodes reading: 16.1
Binary Trees Based on slides by Alyssa Harding & Marty Stepp
Building Java Programs
CSE 143 Lecture 27: Advanced List Implementation
Lecture 26: Advanced List Implementation
CSE 143 Lecture 6 References and Linked Nodes reading: 16.1
Dynamic Data Structures and Generics
slides created by Marty Stepp and Hélène Martin
slides created by Marty Stepp
slides created by Alyssa Harding
CSE 143 Lecture 5 References and Linked Nodes
Dynamic Data Structures and Generics
Java Programming with BlueJ Objectives
slides created by Marty Stepp
ITI Introduction to Computing II Lab-12
slides adapted from Marty Stepp
Lecture 7: Linked List Basics reading: 16.2
Lecture 6: References and linked nodes reading: 16.1
CSE 143 Lecture 7 References and Linked Nodes reading: 16.1
slides adapted from Marty Stepp
slides created by Marty Stepp
Linked Lists and Loops based on slides by Ethan Apter
Binary Search Trees Based on slides by Marty Stepp & Alyssa Harding
CSE 143 Lecture 21 Advanced List Implementation
slides created by Marty Stepp
Presentation transcript:

slides created by Marty Stepp CIS 211 Midterm Review slides created by Marty Stepp http://www.cs.washington.edu/143/ revised by Daniel Lowd

Feedback: Good Live programming (x10) Lectures (x5) Examples (x5) Assignments (x3) Slides/notes (x3) Extra credit (x2)

Feedback: Bad More discussion of homework in lab (x3) More discussion of homework in class (x2) Homework instructions are confusing

Tentative Schedule Week 6: Midterm review and midterm Week 7: GUIs! Week 8: Finish GUIs, recursion Week 9: binary trees Week 10: data structures and review Final exam!

The Midterm 25% of your grade = 5 homework assignments Covers everything we’ve discussed in lecture and homework Study strategy: Midterm and final from last quarter Practice-It problems Study your own notes and the online slides Textbook My midterms tend to be challenging and long.

Exam Question Types 1. Reading: Reference manipulation (EQ1) 2. Reading: Throwing and catching exceptions 3. Reading: List/ArrayList usage (EQ2) 4. Reading: Inheritance mess (EQ3) 5. Writing: Implement inheritance and Comparable interface 7. Writing: Linked list operations (EQ4) 8. Writing: Using lists and iterators (EQ5)

Not on the test Sets, Maps, Stacks, Queues Complexity (big-O notation) Recursion

What does this code print when run? Example Question 1 ListNode x = new ListNode(1); ListNode y = new ListNode(2, x); ListNode z = new ListNode(3, y); x.next = z; y.next.next = y; z = x; x.data = 4; y.data = 6; z.next.data= 5; System.out.println("x: " + x.data); System.out.println("y: " + y.data); System.out.println("z: " + z.data); What does this code print when run?

Example Question 2 public static void mystery(List<Integer> list) { for (int i = 0; i < list.size(); i++) { int n = list.get(i); if (n % 10 == 0) { list.remove(i); list.add(n); } System.out.println(list); Write the output for the following lists inputs: [1, 20, 3, 40] [80, 3, 40, 20, 7] [40, 20, 60, 1, 80, 30]

Example Question 3 public class Do { public void m1() { System.out.println("A1"); } public void m2() { m1(); System.out.println("A2"); } public class Re extends Do { public void m1() { System.out.println("B1"); } public void m3() { System.out.println("B3"); } public class Mi extends Re { public void m1() { m3(); System.out.println("C1"); super.m2(); System.out.println("C2"); Suppose the variables are defined: Do do1 = new Do(); Do do2 = new Re(); Do do3 = new Mi(); Object obj1 = new Do(); Object obj2 = new Re(); What do the following statements do? (Write “error” for errors.) do1.m2(); do2.m2(); do3.m1(); do3.m2(); do3.m3(); ((Re) do3).m3(); ((Re) do3).m1(); obj1.m1(); ((Re) obj1).m2(); ((Do) obj2).m1();

Example Question 4 Add the method removeEvens to LinkedIntList, which remove all even numbers from the list. You may not use an iterator or call any other LinkedIntList methods. You may declare ListNode variables, but you may not construct any new ListNode objects. Recall the definitions of the ListNode and LinkedIntList classes: public class ListNode { public int data; public ListNode next; } public class LinkedIntList { // Reference to the first node in the list private ListNode front; ... Here is the declaration of the function you are to implement, as a member of the LinkedIntList class: /** * Removes all even numbers from this list. */ public void removeEvens()

Example Question 5 Write the method listCompare, which compares two lists of characters lexicographically (dictionary order). listCompare should return a negative integer if the first list should be ordered before the second, a positive integer if the first list should be ordered after the second, and zero if their contents are equal. Do not use any String objects or methods Ordering example: [] < [’a’, ’b’, ’c’] < [’c’, ’a’, ’t’] < [’c’, ’a’, ’t’, ’s’] < [’z’] So your method must return a positive number if passed a first list containing [’c’, ’a’, ’t’, ’s’] and a second list containing [’c’, ’a’, ’t’], since “cats” comes after “cat” in the dictionary. If either List is null, throw an IllegalArgumentException.