Selection Sort Insertion Sort if time

Slides:



Advertisements
Similar presentations
1 Various Methods of Populating Arrays Randomly generated integers.
Advertisements

START DEFINITIONS values (3) N1 = (8, 1,-9) i N1 average N3,2 sum N2 = 0 temp N1 Do not guess or assume any values! Follow the values of the variables.
Conditionals with Strings The comparison operators we’ve seen so far (==, !=, >=, > etc.) all apply to numbers ( ints floats doubles etc.) and return either.
Introduction to working with Loops  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming.
Introduction to Computers and Programming Lecture 8: More Loops New York University.
Introduction to Computers and Programming More Loops  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course.
CS102--Object Oriented Programming Lecture 6: – The Arrays class – Multi-dimensional arrays Copyright © 2008 Xiaoyan Li.
Conditionals with Strings The comparison operators we’ve seen so far (==, !=, >=, > etc.) all apply to numbers ( ints floats doubles etc.) and return either.
CS 106 Introduction to Computer Science I 10 / 16 / 2006 Instructor: Michael Eckmann.
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.
Week 2 - Friday.  What did we talk about last time?  Data representation  Binary numbers  Types  int  boolean  double  char  String.
Chapter 8 ARRAYS Continued
Week #2 Java Programming. Enable Line Numbering in Eclipse Open Eclipse, then go to: Window -> Preferences -> General -> Editors -> Text Editors -> Check.
CPS 2231 Computer Organization and Programming Instructor: Tian (Tina) Tian.
Chapter 14: Sorting and searching. Chapter Goals To study several sorting and searching algorithms To appreciate that algorithms for the same task can.
Part 2. Searching Arrays Looking for a specific element in an array E.g., whether a certain score (85) is in a list of scores Linear search Binary search.
Week 2 - Wednesday.  What did we talk about last time?  Data representation  Binary numbers  Types  int  boolean  double  char  String.
Georgia Institute of Technology More on Creating Classes part 2 Barb Ericson Georgia Institute of Technology Oct 2005.
Review TEST 2 Chapters 4,5,7. QUESTION For which type of operands does the == operator always work correctly: (a) int, (b) double, or (c) String?
Truth and while Today 15 Minutes online time to finish the random/Swing programs. Truth tables: Ways to organize results of Boolean expressions. Note Taking:
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 6 Functions.
1 Class Chapter Objectives Use a while loop to repeat a series of statements Get data from user through an input dialog box Add error checking.
Introduction to Computers and Programming Lecture 7:
COMP Loop Statements Yi Hong May 21, 2015.
int [] scores = new int [10];
Array Review Selection Sort Get out your notes.. Learning Objectives Be able to dry run programs that use arrays Be able to dry run programs that use.
Section 2.2 The StringLog ADT Specification. 2.2 The StringLog ADT Specification The primary responsibility of the StringLog ADT is to remember all the.
Input, Output and Variables GCSE Computer Science – Python.
Chapter 5 Arrays F Introducing Arrays F Declaring Array Variables, Creating Arrays, and Initializing Arrays F Passing Arrays to Methods F Copying Arrays.
Arrays Chapter 7.
Sophomore Scholars Java
Linked Data Structures
CompSci 230 S Programming Techniques
Chapter 4 Unordered List.
Logger, Assert and Invariants
Introduction To Repetition The for loop
Recitation 13 Searching and Sorting.
Agenda Warmup AP Exam Review: Litvin A2
Chapter 6 More Conditionals and Loops
Chapter 4 – Control Structures Part 1
Array Review Selection Sort
Preconditions, Postconditions & Assertions
Java Enter your code from FRQ to Shell
Describing algorithms in pseudo code
Java Fix a program that has if Online time for Monday’s Program
Conditions and Ifs BIS1523 – Lecture 8.
Interfaces and Constructors
Truth tables: Ways to organize results of Boolean expressions.
Sorts on the AP Exam Insertion Sort.
Computer Science 2 Getting an unknown # of …. Into an array.
Truth tables: Ways to organize results of Boolean expressions.
Java Fix a program that has if Online time for Monday’s Program
python.reset() Also moving to a more reasonable room (CSE 403)
int [] scores = new int [10];
Variables, Types, Operations on Numbers
Variables, Types, Operations on Numbers
Stacks.
Truth tables: Ways to organize results of Boolean expressions.
Suggested self-checks: Section 7.11 #1-11
The Generic List<> Collection class
Single-Result Functions & Modularity
AP Computer Science A 2/6/2018.
Exercise 5 1. We learned bubble sort during class. This problem requires you to modify the code for bubble sorting method to implement the selection sorting.
Introduction to Python
LOOPS The loop is the control structure we use to specify that a statement or group of statements is to be repeatedly executed. Java provides three kinds.
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.
Array Review Selection Sort
Random Numbers while loop
The while Looping Structure
Agenda Warmup Lesson 1.9 (random #s, Boolean variables, etc)
Presentation transcript:

Selection Sort Insertion Sort if time Test Corrections Selection Sort Insertion Sort if time

APCS Test Corrections What do I do to make corrections? Use your brain and, if necessary, chapter notes/text/notebook to find the correct answer. Write the correct answer. Write why you consider your answer to be correct, by supporting your answer Write why you got the answer wrong. This requires reflection on how you interpreted the question/answer and why you believe your misinterpreted it.

What will I get for making corrections? For this test. I will regrade it after test corrections and record the corrected test score Other benefits include reviewing information, which confused you, increasing your understanding of Computer Science, and improving your multiple choice test taking skills.

How long do I have to make corrections? You have one week after the exam is returned. Do I have to make corrections? No. You will keep your initial test score

What should corrections look like? Sample Question: Colonial American taverns were all of the following except: frequented mainly by the lower classes another cradle of democracy hotbeds of agitation for the Revolutionary movement important in crystallizing public opinion places providing amusement Question #1: _A_is the correct answer. I put D because I didn’t know the term “crystallizing.” I also didn’t understand “public opinion” so I thought this must be the “exception” answer. I did not pick the correct answer because I thought only lower classes hung out in taverns back then. This time, when I looked at all the choices, I realized b, c and d are about the Revolution so the most likely choices are either a or e. When I looked up information on the role of taverns, I found out all kinds of people hung out in taverns and people played cards and sang so they had amusement.

Will I get credit for every correction I make? No. Simply copying or paraphrasing the answer will not earn you any credit. You must show reasoning or reflection. Here is an example of how not to do it: Questions #1: The answer should be _A_. The “except” answer is “frequented mainly by the lower classes” because the other answers are correct.

Free Response Question. For the questions Free Response Question. For the questions. Complete any three of the following. Describe the task(s) you need to accomplish(1 pt) List the pre-conditions(1 pt) List the post-condition(1 pt) Start coding at the header(9 pts) Write a Boolean method isIncreasing() to determine if all of the values from the start to an ending index (stop) of the array array are increasing in value. /** @param array an array of positive integer values * @param stop the last index to check * Precondition: 0 <= stop < array.length * @return true if for each j such that 0 <= j < stop, array[j] < array[j + 1] ; * false otherwise */ public static boolean isIncreasing(int[] array, int stop) { /* implementation not shown */ } Read over the problem and give a clear summary of what the code needs to accomplish Initial state of variables, assumptions as listed in the problem. Value(s) returned, variables changed. The header of the method is included in the question. Copy the header in your answer then continue to code. You do NOT need to include imports.

Outline for Today Test Corrections Selection Sort Programs S.N.O.T. Selection Sort Programs Sorting Strings using sample code. Sorted, mean, median Pushes: Find the mode: The most often occurring value. Multiple modes? No mode? Let the user tell you how many scores prior to entering the scores Add a method that will return an array of the 5 highest scores. Add a method that will return the modified average. If the pre-sorted scores are in increasing order (continual improvement), it will return the average of the top 3 scores, otherwise with will return the entire average. Insertion Sort Program Notes on class website

Selection Sort Program Input 11 scores in main body Output: Numbers in sorted order (Low to High): Method Mean (average): Method Median (Middle number after sorting): Method Push: Find the mode: The most often occurring value. Multiple modes? No mode? Let the user tell you how many scores prior to entering the scores Add a method that will return an array of the 5 highest scores. Add a method that will return the modified average. If the pre-sorted scores are in increasing order (continual improvement), it will return the average of the top 3 scores, otherwise with will return the entire average.

Shell for the Selection Sort program. import java.util.Scanner; public class SortOfFun { public static void main(String [] args) } public static void selectionSort(int [] unsortedArray) public static void show(int [] arrayToShow) public static int meany(int [] theArray) public static int medianfinder(int [] theArray) Shell for the Selection Sort program.