CS100J Nov 04, 2003 Arrays --sorting. Reading: 8.5 Please punctuate this: Dear John, I want a man who knows what love is all about you are generous kind.

Slides:



Advertisements
Similar presentations
SORTING Lecture 12B CS2110 – Spring InsertionSort 2 pre: b 0 b.length ? post: b 0 b.length sorted inv: or: b[0..i-1] is sorted b 0 i b.length sorted.
Advertisements

SEARCHING AND SORTING HINT AT ASYMPTOTIC COMPLEXITY Lecture 9 CS2110 – Spring 2015 We may not cover all this material.
Letters, Memos, and s. The Letter (Used generally outside the organization)  Return Address  Date  Inside Address  Salutation  Body  Complimentary.
Rein in those Runaway Sentences! Comma Splices and Fused Sentences Presented by Carol Dillon and Lynn Ramert.
Learning Objective: Punctuation! Understand how it can change meaning and why it is important. These sentences have different meanings. How?
The Importance of Punctuation Dear Jack. A woman, without her man, is nothing. A woman, without her man, is nothing. A woman: without her, man is nothing.
English Writing Part 2: Info Cards, Punctuation & Process John E. Clayton Nanjung University, Fall, 2004.
Punctuation Aim: To understand the importance of correct punctuation.
Dear John, I want a man who knows what love is all about
THE WRITE STUFF! Do You Have It?. Why is it important to be able to write well/effectively?
L ITERACY T HROUGH M USIC John Hunter II 7/13/12.
Powerful Punctuation Why it’s important to get it right!
1 CS100J 27 March 2007 Algorithms on arrays Reading: 8.3–8.5 Please punctuate this: Dear John, I want a man who knows what love is all about you are generous.
CS 1110 Prelim III: Review Session 1. Info My name: Bruno Abrahao – We have two other TA’s in the room to help you individually Beibei Zhu Suyong Zhao.
1 Teaching the development of algorithms Teach skill, not only facts David Gries Computer Science Department Cornell University November 2004 DrJava is.
1 CS100J 29 March 2007 Arrays: searching & sorting. Reading: 8.5 Why did I get a Christmas Card on Halloween? Searching and sorting algorithms are on the.
How to Support Students with Personal Statements Phil Lumby Birmingham City University Kim Eccleston University of Warwick.
Foundation Assessment Centres How to Prepare, Attend (and survive…)
Instructor:Marc Schiffman CM241: Foundations of Technical Communications I will turn on our audio in a few minutes. Take this opportunity to review your.
CONVENTIONS Key elements? Key Elements? Examine Primary Rubric to identify key qualities of this trait 1.
Software Institute Part 1: Introduction John E. Clayton Nanjung University, Fall, 2004.
The POWER of Punctuation! Did you know that commas have the power to save lives???
1 CS100J 31 October 2006 Arrays: searching & sorting. Reading: 8.5 Merry Christmas!! On Halloween? Searching and sorting algorithms are on the course website.
Why it’s important to get it right!
Final Prep workshop for your final project “Make your Own Lab”
PUNCTUATIONPUNCTUATIONPUNCTUATIONPUNCTUATION.?,:; ! “ ”
Advice from Eats, Shoots & Leaves By Lynne Truss Powerpoint by Ms. Fehrenbacher.
CS November 2010 Developing array algorithms. Reading: Haikus (5-7-5) seen on Japanese computer monitors Yesterday it worked. Today it is.
Is Punctuation Really that Important? You decide….
1 CS November 2010 insertion sort, selection sort, quick sort Do exercises on pp to get familiar with concepts and develop skill. Practice.
Language The World of Words. The Nature of Language.
P ROOFREADING Lucy Sefton. A IMS AND OBJECTIVES Aim : Practice proofreading skills Objectives:  Take part in discussions regarding proofreading  Proofread.
1 CS April 2010 binary search, linear search insertion sort, selection sort, quick sort Do exercises on pp to get familiar with concepts.
Commas Matter!.
Is it important?.  Dear John: I want a man who knows what love is all about. You are generous, kind, thoughtful. People who are not like you admit.
Conventions Woman without her man has no reason for living. Woman: without her, man has no reason for living.
1 CS April 2009 Sorting: insertion sort, selection sort, quick sort Do exercises on pp to get familiar with concepts and develop skill.
Observation - FUN Mr. McEwen 6 th Grade Science.
Author’s Purpose Modes of Writing. Three Reasons for Writing 1.To Inform (Expository) 2.To Persuade (Persuasive) 3.Entertain (Narrative or Poetry)
The Power of Punctuation Remember…. Eats, shoots and leaves? Think about that with this love letter.
Comm Arts-Day 3 Reflection-Sentence Quiz Post your response to the questions below on edmodo: What score did you receive on your quiz? Are you happy or.
Examples of Punctuation
Personal Statements PS Bath. Personal Statement – guess the right answer.
Recognising Opportunities to Include Functional Skills English Lucy Crofts.
1 CS April 2010 insertion sort, selection sort, quick sort Do exercises on pp to get familiar with concepts and develop skill. Practice.
Children mysterious beside as hopefully those she had jumped Match the word to its word class.
1 CS100J 21 March 2006 Arrays: searching & sorting. Reading: 8.5 Please punctuate this: Dear John, I want a man who knows what love is all about you are.
PUNCTUATION : Making your message clear. PUNCTUATION : MAKING YOUR MESSAGE CLEAR.
Paige, Rasinski, & Magpuri-Lavell (2012)
RHETORICAL GRAMMAR LESSON #22. OUTCOME 1 To demonstrate an awareness of the strategies that writers use in different writing contexts.
Remind students of last week’s T4TW
CS100J 30 October 2007 Algorithms on arrays Reading: 8.3–8.5
. ? , : ; ! “ ” P U N C T U A T I O N.
Why it’s important to get it right!
A few things to think about. . .
Punctuation.
A True Definition! Hopefully?!
Why Punctuation Matters
Binary Search and Loop invariants
CS November 2010 Developing array algorithms. Reading:
Searching and Sorting Hint at Asymptotic Complexity
Searching and Sorting Hint at Asymptotic Complexity
Linear and Binary Search
Commas.
CS100J Nov 04, 2003 Arrays. Reading: 8
The importance of syntax…
Author’s /IntentPurpose Meets Grammar
Advice from Eats, Shoots & Leaves By Lynne Truss
Searching and Sorting Hint at Asymptotic Complexity
Searching and Sorting Hint at Asymptotic Complexity
Presentation transcript:

CS100J Nov 04, 2003 Arrays --sorting. Reading: 8.5 Please punctuate this: Dear John, I want a man who knows what love is all about you are generous kind thoughtful people who are not like you admit to being useless and inferior you have ruined me for other men I yearn for you I have no feelings whatsoever when we're apart I can be forever happy will you let me be yours Gloria Quiz on Tuesday: linear search, binary search, finding the minimum.

This is a neat example of the ambiguity that English can cause, if not used properly! We try to use English properly and precisely, but ambiguity tends to creep in because of diffierence in cultures in which people grow up and simply because of differences of opinion. Read on! Dear John: I want a man who knows what love is all about. You are generous, kind, thoughtful. People who are not like you admit to being useless and inferior. You have ruined me for other men. I yearn for you. I have no feelings whatsoever when we're apart. I can be forever happy -- will you let me be yours? Gloria Dear John: I want a man who knows what love is. All about you are generous, kind, thoughtful people, who are not like you. Admit to being useless and inferior. You have ruined me. For other men, I yearn. For you, I have no feelings whatsoever. When we're apart, I can be forever happy. Will you let me be? Yours, Gloria.

Linear search.Vague spec.: find first occurrence of v in b[h..k]. Better spec.: Store an integer in i to truthify: postcondition: (0) v is not in b[h..i-1] (1) Either i= k or v = b[k] invariant: v is not in b[h..i-1] Finding the min. Vague spec.: Find the minimum of b[h..k] Better spec.: Precondition: h <= k (because an empty set of values has no minimum) Store in I to truthify: postcondition: b[m] is the minimum of b[h..k] (and it is the first occurrence of the minimum) invariant: b[m] is the minimum of b[h..t-1] (and it is the first occurrence of the minimum) Binary search: Vague spec: Look for v in sorted array segment b[h..k]. Better spec: Precondition: b[h..k] is sorted (in ascending order). Store in i to truthify: postcondition: b[h..i] <= v and v < b[i+1..k] invariant: b[h..i] <= v and v < b[j..k]

Algorithms to be covered today: Partitioning an array segment. Given an array: swap its values around so that it looks like this: Selection sort. Insertion sort. x ? h k ≤ x x ≥ x h k

Partition: Sorting: x ? h k ≤ x x ≥ x h j k pre: post: x ≤ x ? ≥x h i j k inv: x ≤ x ≥x h j i k post1: ? h k pre: sorted h k post: ≤ b[i..k], sorted ≥b[h..i-1], ? h i k selectionsort inv: sorted ? h i k insertionsort inv: