CS 280 Data Structures Professor John Peterson. Grading the Projects Boo-boos: Not allowing bubble sort to exit soon enough Mistakes in the heapify, especially.

Slides:



Advertisements
Similar presentations
Introduction to C++ Templates Speaker: Bill Chapman, C++ developer, financial company in Mid-Manhattan. Can be reached via: ' This.
Advertisements

Discussion1 Quiz. Q1 Which of the following are invalid Java identifiers (variable names)? a) if b) n4m3 c) Java d) e) DEFAULT_VALUE f) bad-choice.
1 Working with References. 2 References Every object variable is a reference to an object Also true when an object is passed as an argument When the object.
This Time Pointers (declaration and operations) Passing Pointers to Functions Const Pointers Bubble Sort Using Pass-by-Reference Pointer Arithmetic Arrays.
HFJ CHAPTER 5 REVIEW Don’t forget: You can copy- paste this slide into other presentations, and move or resize the poll. Poll: What is the purpose of.
CS414 C Programming Tutorial Ben Atkin
CS 280 Data Structures Professor John Peterson. Quiz Wrapup interface Comparable { public boolean gtr(T x, T y); } class Student { public int studentNumber;
CS 280 Data Structures Professor John Peterson. Netbeans Magic What you did on Project 2 can be done much more easily if you use the refactoring menu.
CS 280 Data Structures Professor John Peterson. Merge Sorting Questions?
Lecture 27 Exam outline Boxing of primitive types in Java 1.5 Generic types in Java 1.5.
CS 280 Data Structures Professor John Peterson. Examples N copies?
CS 280 Data Structures Professor John Peterson. Quiz 4 Recap Consider the following array: {2, 6, 7, 3, 4, 1, 5, 9}. Draw this in tree form and then show.
Project Description. Creating your dababase application with PHP It will be sufficient to have an application that accommodates all the need of the intended.
CS 280 Data Structures Professor John Peterson. Test #1 We’ll do a test next week on Wednesday. It will take the entire period. You can have 1 page of.
CS 280 Data Structures Professor John Peterson. Invariants Back to Invariants! Recall the insertion sort invariant – how can we turn this into debugging.
CS 280 Data Structures Professor John Peterson. Test #1 We’ll do a test next week on Wednesday. It will take the entire period. You can have 1 page of.
CS102 Data Types in Java CS 102 Java’s Central Casting.
CS Oct 2006 Chap 6. Functions General form; type Name ( parameters ) { … return value ; }
CS 280 Data Structures Professor John Peterson. Goals Understand “Programming in the small” Java programming Know what’s under the hood in complex libraries.
CS 280 Data Structures Professor John Peterson. Homework #1 Remember: this is due by class Wednesday! Ask questions now or by /wiki
CS 280 Data Structures Professor John Peterson. Test #1 We’ll do a test next week on Wednesday. It will take the entire period. You can have 1 page of.
1 Programming section 3 2 Importing classes purpose packages CLASSPATH creating and using a package.
CS 280 Data Structures Professor John Peterson. Goals Understand “Programming in the small” Java programming Know what’s under the hood in complex libraries.
CS 280 Data Structures Professor John Peterson. Example: log(N) This is where things get hairy! How would you compute Log 10 (N) in a very approximate.
CS 280 Data Structures Professor John Peterson. Next Project YET ANOTHER SORT! We’ll do Quicksort using links instead of arrays. Wiki time.
28-Jun-15 Recursion. 2 Definitions I A recursive definition is a definition in which the thing being defined occurs as part of its own definition Example:
CS 117 Spring 2002 April 5, Exam 3 April 10 –files, arrays, strings, classes –practice exams are up –review on Monday.
Inheritance and interfaces A class C1 is derived from class C2, then C1 is called subclass, and C2 is called superclass Superclass-parent, base class Subclass.
29-Jun-15 Recursion. 2 Definitions I A recursive definition is a definition in which the thing being defined occurs as part of its own definition Example:
CS 280 Data Structures Professor John Peterson. Test #1 We’ll do a test next week on Wednesday. It will take the entire period. You can have 1 page of.
CS 280 Data Structures Professor John Peterson. heapify void heapify(int i, Sortable s, int n) { // n is the limit of s int l = left(i); // 2*i+1 int.
CS 280 Data Structures Professor John Peterson. Homework / Project Note the homework isn’t due till tomorrow. Plus it’s not too hard. The project IS due.
CS 106 Introduction to Computer Science I 02 / 19 / 2007 Instructor: Michael Eckmann.
CS 280 Data Structures Professor John Peterson. Homework Answers boolean m(int a[]) { for (int i = 0; i < a.length; i++) { for (int j = i+1; j < a.length;
Interfaces besides classes, Java recognizes another type, an interface interface is used to completely shield off all implementation from the programmer.
CS0007: Introduction to Computer Programming Introduction to Arrays.
1 Programming Section 11 James King 12 August 2003.
CS 11 C++ track: lecture 7 Today: Templates!. Templates: motivation (1) Lots of code is generic over some type Container data types: List of integers,
CS 2430 Day 26. Announcements Exam #2: Wednesday, April 3 –Review in lab on Tuesday, April 2 –Sample problems sent via .
Effective Java: Generics Last Updated: Spring 2009.
CSE 12 – Basic Data Structures Cynthia Bailey Lee Some slides and figures adapted from Paul Kube’s CSE 12 CS2 in Java Peer Instruction Materials by Cynthia.
CS 11 java track: lecture 4 This week: arrays interfaces listener classes inner classes GUI callbacks.
PHP Logic. Review: Variables Variables: a symbol or name that stands for a value – Data types ( Similar to C++ or Java): Int, Float, Boolean, String,
Recitation 2 James Wei Professor Peck 1/17/2013. Covered in this Recitation Arrays Variable Scoping Local variables Instance variables Class variables.
Generic Programming  Object Type  Autoboxing  Bag of Objects  JCL Collections  Nodes of Objects  Iterators.
Exam Format  90 Total Points  60 Points Writing Programs  25 Points Tracing Code/Algorithms and determining results  5 Points Short Answer  Similar.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Types and Interfaces COMP.
CS 162 Intro to Programming II Bubble Sort 1. Compare adjacent elements. If the first is greater than the second, swap them. Do this for each pair of.
CS 61B Data Structures and Programming Methodology July 2, 2008 David Sun.
CS 139-Programming Fundamentals Lecture 11B - Arrays Adapted from a presentation by Dr. Rahman Fall 2014.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Chapter 7: Class Inheritance F Superclasses and Subclasses F Keywords: super and this F Overriding methods F The Object Class F Modifiers: protected, final.
CS1101 Group1 Discussion 10 Lek Hsiang Hui comp.nus.edu.sg
1 CSE 331 Generics (Parametric Polymorphism) slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia
CS 2430 Day 24. Announcements Quiz this Friday Program 5 posted on Monday Program 4 due date: Friday at 10pm Program 4 grace date: Wednesday at 10pm (don’t.
A: A: double “4” A: “34” 4.
CS Prelim Review – 10/15/09  First prelim is TOMORROW at 7:30 PM  Review session – Tonight 7:30 PM, Phillips 101  Things you should do:  Review every.
Pointer Data Type and Pointer Variables III CS1201: Programming Language 2 By: Nouf Aljaffan Edited by : Nouf Almunyif.
ECE 103 Engineering Programming Chapter 15 C Standard Library Herbert G. Mayer, PSU CS Status 7/19/2015 Initial content copied verbatim from ECE 103 material.
Defensive Programming. Good programming practices that protect you from your own programming mistakes, as well as those of others – Assertions – Parameter.
Lecture 9:FXML and Useful Java Collections Michael Hsu CSULA.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #003 (February 14, 2015)
Linked Lists CS 367 – Introduction to Data Structures.
JAVA GENERICS Lecture 16 CS2110 – Spring 2016 Photo credit: Andrew Kennedy.
CSE 1301 Lecture 12 Arrays Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
The Object-Oriented Thought Process Chapter 03
design OO words Debug Variables Data types
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
RANDOM NUMBERS SET # 1:
Agenda Warmup Lesson 2.4 (String concatenation, primitive types, etc)
Presentation transcript:

CS 280 Data Structures Professor John Peterson

Grading the Projects Boo-boos: Not allowing bubble sort to exit soon enough Mistakes in the heapify, especially stage 2 Mistakes in the random data generator, particularly the almost sorted. Instance variables that shouldn’t be Bad variable names / cryptic code Not keeping track of numSwaps / compares Not deleting useless code from a project Casting – always an error except (int) to convert float to int. Copying in illogical places (should be in new Snapshot)

Homework Wrapup interface Comparable { public boolean gtr(T x, T y); } class Student { public int studentNumber; public String studentName; } Comparable to sort students by number. Comparable to sort students by name. Sort students given an array of students and a Comparable object. Write the signature of a general sort method using arrays and a comparable

Generic Methods Suppose we don’t know what sort of object is being sorted but we do know that the sort will take an array of these objects and a Comparable – how would you write the signature of this more general sort method? (Warning – we haven’t covered some of this so you might have to guess part of the answer!)

Questions on the Practice Quiz

Complexity Practice