Insertion Sort Quiz on Thursday.

Slides:



Advertisements
Similar presentations
Using Flowcharts. Sample Flowchart (without text) 2.
Advertisements

 Control structures  Algorithm & flowchart  If statements  While statements.
Text Chapters 1, 2. Sorting ä Sorting Problem: ä Input: A sequence of n numbers ä Output: A permutation (reordering) of the input sequence such that:
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the basic concepts and uses of arrays ❏ To be able to define C.
THIS IS JEOPARDY Mean MedianRange Order of Operations.
Creating Histograms on the TI-84 and in Excel Mr. Ricks Madison High School.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 3, Lecture 1.
Mean: The AVERAGE values of a set of numbers. The mean is found by ADDING all of the values, then DIVIDING by the number of values in the set of data.
Intro to Nested Looping Intro to Computer Science CS1510 Dr. Sarah Diesburg.
By the end of this lesson you will be able to explain/calculate the following: 1. Mean for data in frequency table 2. Mode for data in frequency table.
The number which appears most often in a set of numbers. Example: in {6, 3, 9, 6, 6, 5, 9, 3} the Mode is 6 (it occurs most often). Mode : The middle number.
Java Methods 11/10/2015. Learning Objectives  Be able to read a program that uses methods.  Be able to write a write a program that uses methods.
Computer Science I: Understand how to evaluate expressions with DIV and MOD Random Numbers Reading random code Writing random code Odds/evens/…
Songs HKOI Problem Description Dr. Jones wants to play the lowest key possible Musical notes are represented by positive integers Increasing the.
Measures of Central Tendency PS Algebra I. Objectives Given a set of data, be able to find the following: 1) mean* 2) median* 3) mode* 4) range 5) first.
Tech 539 PowerPoint Tutorial How to choose themes, layouts, transitions, and add charts Created using PowerPoint on a Mac.
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.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 3 - Structured Program Development Outline.
Permutations and Combinations Review Plus a little Dry Run, Sorting and Code.
Computer Science 2 Arrays of Records. First Record Program Input an unknown number of Team Names, School names, and Total scores. (While loop) –Output:
Starter Complete the Word Search. CG3.7 Algorithms (The Insertion Sort (Chapter 46) & Algorithm Testing)
Statistics Unit Check your understanding…. Can you answer these? What does the standard deviation of a sample represent? What is the difference between.
POS 409 MASTER Education Expert/pos409master.com FOR MORE CLASSES VISIT
DEVRY COMP 122 L AB 6 L AB R EPORT AND S OURCE C ODE C HECK THIS A+ TUTORIAL GUIDELINE AT HTTP :// WWW. ASSIGNMENTCLOUD. COM / COMP -122/ COMP LAB.
Measures of Central Tendency
Quiz # 02 Design a data type Date to hold date
Chapter 8 Arrays Objectives
© T Madas.
Chapter 3 Describing Data Using Numerical Measures
Array Review Selection Sort
Program options Write a program for one of the following
Java Fix a program that has if Online time for Monday’s Program
Python I/O.
Chapter 8 Arrays Objectives
Intro to Nested Looping
Sorts on the AP Exam Insertion Sort.
Computer Science 2 Arrays of Records.
Computer Science 2 Review the Bubble Sort
Continue on the Array of Records program
Computer Science 2 Arrays of Records.
Computer Science 2 Getting an unknown # of …. Into an array.
Java Fix a program that has if Online time for Monday’s Program
To be able to identify and use function notation.
Insertion Sort.
Intro to Nested Looping
Computer Science Sorting.
Computer Science 2 Arrays of Records.
Computer Science Sorting Pre-Test Discussion/program
CS 2 Records 2/22/2018.
§ § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § § ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊
Chapter 8 Arrays Objectives
AP Java 9/21/2018.
EPSII 59:006 Spring 2004.
Sorting Develop a sorting algorithm
Computer Science 1 while
Computer Science 1 For..do loop Dry Run Take notes on the For loop
Welcome Back CS 2 2/4/2013 On the record (paper) write the following
Line Plots have two advantages: You can see
Intro to Programming 2/23/2016 Review Sections 1-3
Computer Science I: Get out your notes.
Array Review Selection Sort
Program options Write a program for one of the following
Dry Run Fix it Write a program
Computer Science 1 while
Insertion Sort.
Random Numbers while loop
Computer Science 1 while
Dry Run Fix it Write a program
Selection Sort Insertion Sort if time
Insertion and Shell Sorts
Presentation transcript:

Insertion Sort Quiz on Thursday

Learning Objectives Review the Bubble and Selection Sorts Understand the speed, stability and how the insertion sort works Be able to write a program that uses either the Selection or the Insertion sort. Prepare for Thursday’s Quiz over arrays, sorts, and … the semantics of a while loop.

Review Show after each pass of the Bubble Sort Low High 10 6 20 15 90 12 14 Show after each pass of the Selection Sort

Insertion Sort Can you describe how it works? Animation https://www.cs.usfca.edu/~galles/visualization/ComparisonSort.html

Insertion Sort Details Speed Stability How it works Your turn Low High 20 10 8 12 31 9 15

Procedure insertion(var theArray:theArrayType; size:integer); dummy:integer; pass, check:integer; Begin for pass:= 2 to size do begin dummy:= theArray[pass]; check := pass-1; while (theArray[check]>dummy) and (check>=1) do theArray[check+1] := theArray[check]; check:=check-1; end; theArray[check+1] := dummy; End;

Program Options Song Sort: Input an unknown number of songs (but less than 100) Show out of order Sort Show in order Push: Let the user also enter the Style of music, and be able to sort by style. Name age sort Input: An unknown number of names and ages Output: The names and corresponding ages in a chart sorted by age. Push: Let the user decide if they want to sort by age or name, then sort and show the chart. Stats are great Input:9 integers Output: The mean, median and range of the values Push: Let the user enter an unknown number of scores, but less than 100 and calculate the above Push: Find the mode!!