CS211 Spring 2004 Lecture 06 Loops and their invariants. Software engineering reason for using loop invariants

Size: px
Start display at page:

Download "CS211 Spring 2004 Lecture 06 Loops and their invariants. Software engineering reason for using loop invariants"

Transcription

1 CS211 Spring 2004 Lecture 06 Loops and teir invariants Reading material: Tese notes. Weiss: Noting on invariants. ProgramLive: Capter 7 and 8 O! Tou ast damnale iteration and art, indeed, ale to corrupt a saint. Saespeare, Henry IV, Pt I, 1 ii Use not vain repetition, as te eaten do. Mattew V, 48 Your if is te only peacemaer; muc virtue if if. Saespeare, As You Lie It. /** Toen Scan.getToen() is first toen of a sentence for E. Parse it, giving error messages if tere are mistaes. After te parse, Scan.getToen() sould e te symol following te parsed E. Rule: E::= T { <+ -> T */ pulic static void parsee() { Toen toen= Scan.getToen(); int ind= toen.getkind(); wile (ind == Toen.PLUS ind == Toen.MINUS) { Expression rigt= parset(); exp= new BinOp(exp, toen, rigt); toen= Scan.getToen(); ind= toen.getkind(); return exp; To understand any single part of te loop, you first ave to understand te wole loop and its initialization! Tat is BAD BAD BAD!!! 1 2 Rule: E::= T { <+ -> T */ pulic static void parsee() { Toen toen= Scan.getToen(); int ind= toen.getkind(); // exp is te oject for te expression parsed so far // toen is next toen to process and ind is its ind wile (ind == Toen.PLUS ind == Toen.MINUS) { Expression rigt= parset(); exp= new BinOp(exp, toen, rigt); toen= Scan.getToen(); ind= toen.getkind(); invariant is true efore and after eac iteration // { R: exp is te oject for te expression parsed so far // toen is te next toen to process, and its not part of tis E return exp; 3 Rule: E::= T { <+ -> T */ pulic static void parsee() { Toen toen= Scan.getToen(); int ind= toen.getkind(); // exp is te oject for te expression parsed so far // toen is next toen to process and ind is its ind Loop question 1. Does te initialization mae te invariant true? 4 Rule: E::= T { <+ -> T */ pulic static void parsee() { Rule: E::= T { <+ -> T */ pulic static void parsee() { // exp is te oject for te expression parsed so far // toen is next toen to process and ind is its ind wile (ind == Toen.PLUS ind == Toen.MINUS) { // { R: exp is te oject for te expression parsed so far // toen is te next toen to process, and its not part of tis E Loopy question 2. Wen does loop stop? Can we tell tat result R is true ased on te invariant and te fact tat te loop condition is false? 5 // exp is te oject for te expression parsed so far // toen is next toen to process and ind is its ind wile ( ) { Expression rigt= parset(); Loopy question 3. Does eac iteration mae progress toward termination? 6

2 Rule: E::= T { <+ -> T */ pulic static void parsee() { // exp is te oject for te expression parsed so far // toen is next toen to process and ind is its ind wile (ind == Toen.PLUS ind == Toen.MINUS) { Expression rigt= parset(); exp= new BinOp(exp, toen, rigt); toen= Scan.getToen(); ind= toen.getkind(); Loopy question 4. Does eac iteration eep te invariant true? 7 initialization; // { invariant P wile ( B) { S // { R initialization; // { P wile ( B ) { // { P and B S // { P // {P and! B // { R Te four loopy questions 1. Does te initialization mae P true? 2. From P and falsity of B, can we conclude tat R is true? 3. Does eac iteration mae progress toward termination? 4. Does eac iteration eep P true? 8 Aout array segments [..-1]? as - elements +3 [..+3-1] as +3 - = 3 elements +2 [..+2-1] as +2 - = 2 elements +1 [..+1-1] as +1 - = 1 elements [..+0-1] as +0 - = 0 elements [..-1] is te empty segment starting at [] In te notation [i..j], we always require i! j+1 9 Linear searc: Find first occurrence of v in [..-1] Better spec.: Store an integer in i to trutify: postcondition: (0) v is not in [..i-1] Precondition (1) Eiter i= or v = [i]? i Postcondition v is not ere? and (i = or v = [i]) Oviously, start te searc from [], move forward. Wat is te invariant? Wat is te formula for te numer of values in [..i-1]? i - 10 Linear searc: Find first occurrence of v in [..-1] Binary searc: find v in sorted segment [..-1] i= ; i // v is not ere? wile (i!= && v!= [i]) { i= i+1;? Store in j to trutify: sorted j If v is in, ten [j] is its rigtmost occurrence. If v is not in, ten v elongs rigt after [j]. See Weiss and ProgramLive Section i v is not ere? and (i = or v = [i]) Wat if [..-1] is empty? Tat is, wat if =? Set j to -1, ecause ten: [..j] is [..-1] (empty) and [j+1..-1] is [..-1] (empty) 11 12

3 Binary searc: find v in sorted segment [..-1] Binary searc: find v in sorted segment [..-1] j j j i j i initialize: j= -1; i= ; j= -1; i= ; wile (? ) { Wen can it stop? Wen sould it continue? Binary searc: find v in sorted segment [..-1] Binary searc: find v in sorted segment [..-1] j j j= -1; i= ; wile ( j +1 < i ) { j i How does it mae progress toward termination? 15 j= -1; i= ; wile ( j +1 < i ) { int e= (j+i) / 2; // { j < e < i if ([e] <= v) j= e; else i= e; j i 1. Finds rigtmost value, if in. 2. Finds position were value elongs, if not in. 3. Wors on an empty array. 16 Buggy Binary Searc from a new text on programming /**Searc (sorted) for target using a inary searc. If found, store its position in p, oterwise store -1 in p */ int start= 0; // start of searc region int end=.lengt; // end of searc region int p= -1; // position of target // wile tere is still someting list left to searc and te element as not een // found wile (start <= end && position == -1) { int middle = (start+end)/2; if ( target < [middle]) end= middle - 1; else if (target > [middle]) {start= middle + 1; else position= middle; fails if.lengt = 1, [0] = 0, and target = 1 17 Buggy Binary Searc from a 2002 text on programming /**Searc (sorted) for target using a inary searc. If found, store its position in p, oterwise store -1 in p */ pulic static int execute(int[], int target) { int lo= 0; int i=.lengt; wile (true) { int centre = (i+lo)/2; if (centre == lo) { // only 2 items to test so it is centre, centre+1, or not in if ([centre] == target) return centre; else ([centre+1] == target) return center+1; else return -1; if ([centre] < target) lo= centre; else if (target < [centre]) i= centre; else return centre; suscript out of range if.lengt = 2, [0] = 10 [1] = 20 target = 30 18

4 Buggy Binary Searc from a 2002 text on programming Te mistaes are logical errors, not simple typos. Te comments are generally not elpful. Variales names give no elp at all, in fact are misleading int start= 0; // start of searc region int end=.lengt; // end of searc region int lo= 0; int i=.lengt; Neiter text, lie most texts, give asolutely no elp on ow to develop suc algoritms. You eiter can do it or you can t and you can see tat te autors can t. Dutc national flag: contains red, wite, and lue alls. precondition:? wat invariant to use? Weiss (page 169) says tat inary searc is surprisingly tricy to code. Tat s ecause e does not follow a metodology for developing loops. You can coose your style. Program lie tese texts, getting not only difficulty to understand and complicated code, or learn a simple way of developing loops using invariants and definitions of variales. 19 postcondition: reds wites lues 20 Dutc national flag: contains red, wite, and lue alls. Dutc national flag: contains red, wite, and lue alls. precondition:? precondition:? reds wites lues? 0 w n reds wites lues? How to mae progress in te repetend? (ody of te loop, te ting to e repeated). Cases: [] is lue: increment [] is wite: swap [], [], increment and [] is red: swap [], []; swap [], [w]; increment,, and w postcondition: reds wites lues postcondition: reds wites lues Dutc national flag: contains red, wite, and lue alls. Dutc national flag: contains red, wite, and lue alls. precondition:? precondition:? 0 w n invariant : reds wites? lues w= 0; = 0; = n-1; 0 w n // reds wites? lues Cases: [] is lue: Swap [], []; decrement [] is wite: increment [] is red: swap [], [w]; increment and w postcondition: reds wites lues wile ( <= ) { if ([] is lue) {swap [], []; = -1; else ([] is wite) = +1; else {Swap [], [w]; = +1; w= w+1; postcondition: reds wites lues 23 24

5 Partition algoritm of quicsort (wic we will see later) Plive, Sec. 8.5 (loo at CD), Weiss, page 298 Partition algoritm of quicsort (wic we will see later) precondition: x? precondition: x? (x is not a program variales; it is used just to sow wat is initially in []) Permute te values of [..] and store a value in j to trutify: j postcondition: <= x x >= x j R1: x <= x >= x initial: [..] = { possile final [..] = { possile final [..] = { [j] 25 Swap [] and [j] j postcondition: <= x x >= x 26 Partition algoritm of quicsort (wic we will see later) Partition algoritm of quicsort (wic we will see later) precondition: x? precondition: x? i j x <= x? >= x j R1: x <= x >= x i= +1; j= ; i j x <= x? >= x wile (i <= j) { if ([i] <= x) i= i+1; else {Swap [i], [j]; j= j-1; j R1: x <= x >= x 27 28

SORTING 9/26/18. Prelim 1. Prelim 1. Why Sorting? InsertionSort. Some Sorting Algorithms. Tonight!!!! Two Sessions:

SORTING 9/26/18. Prelim 1. Prelim 1. Why Sorting? InsertionSort. Some Sorting Algorithms. Tonight!!!! Two Sessions: Prelim 1 2 "Organizing is wat you do efore you do someting, so tat wen you do it, it is not all mixed up." ~ A. A. Milne SORTING Tonigt!!!! Two Sessions: You sould now y now wat room to tae te final. Jenna

More information

Sorting and Searching

Sorting and Searching CS 1110: Introduction to Computing Using Pyton Lecture 23 Sorting and Searcing [Andersen, Gries, Lee, Marscner, Van Loan, Wite] Announcements Final Exam conflicts due tonigt at 11:59pm Final Exam review

More information

Announcements SORTING. Prelim 1. Announcements. A3 Comments 9/26/17. This semester s event is on Saturday, November 4 Apply to be a teacher!

Announcements SORTING. Prelim 1. Announcements. A3 Comments 9/26/17. This semester s event is on Saturday, November 4 Apply to be a teacher! Announcements 2 "Organizing is wat you do efore you do someting, so tat wen you do it, it is not all mixed up." ~ A. A. Milne SORTING Lecture 11 CS2110 Fall 2017 is a program wit a teac anyting, learn

More information

Lecture 25. Sequence Algorithms (Continued)

Lecture 25. Sequence Algorithms (Continued) Lecture 25 Sequence Algoritms (Continued) Announcements for Tis Lecture Assignment & Lab A6 is not graded yet Done by end of classes A7 due Wed, Dec. 10 Wednesday after classes Keep on top of milestones

More information

CORRECTNESS ISSUES AND LOOP INVARIANTS

CORRECTNESS ISSUES AND LOOP INVARIANTS Aout A2 and feedack. Recursion 2 CORRECTNESS ISSUES AND LOOP INVARIANTS S2 has een graded. If you got 30/30, you will proaly have no feedack. If you got less than full credit, there should e feedack showing

More information

Data Structures and Programming Spring 2014, Midterm Exam.

Data Structures and Programming Spring 2014, Midterm Exam. Data Structures and Programming Spring 2014, Midterm Exam. 1. (10 pts) Order te following functions 2.2 n, log(n 10 ), 2 2012, 25n log(n), 1.1 n, 2n 5.5, 4 log(n), 2 10, n 1.02, 5n 5, 76n, 8n 5 + 5n 2

More information

MATH 5a Spring 2018 READING ASSIGNMENTS FOR CHAPTER 2

MATH 5a Spring 2018 READING ASSIGNMENTS FOR CHAPTER 2 MATH 5a Spring 2018 READING ASSIGNMENTS FOR CHAPTER 2 Note: Tere will be a very sort online reading quiz (WebWork) on eac reading assignment due one our before class on its due date. Due dates can be found

More information

each node in the tree, the difference in height of its two subtrees is at the most p. AVL tree is a BST that is height-balanced-1-tree.

each node in the tree, the difference in height of its two subtrees is at the most p. AVL tree is a BST that is height-balanced-1-tree. Data Structures CSC212 1 AVL Trees A binary tree is a eigt-balanced-p-tree if for eac node in te tree, te difference in eigt of its two subtrees is at te most p. AVL tree is a BST tat is eigt-balanced-tree.

More information

CS 234. Module 6. October 16, CS 234 Module 6 ADT Dictionary 1 / 33

CS 234. Module 6. October 16, CS 234 Module 6 ADT Dictionary 1 / 33 CS 234 Module 6 October 16, 2018 CS 234 Module 6 ADT Dictionary 1 / 33 Idea for an ADT Te ADT Dictionary stores pairs (key, element), were keys are distinct and elements can be any data. Notes: Tis is

More information

4.1 Tangent Lines. y 2 y 1 = y 2 y 1

4.1 Tangent Lines. y 2 y 1 = y 2 y 1 41 Tangent Lines Introduction Recall tat te slope of a line tells us ow fast te line rises or falls Given distinct points (x 1, y 1 ) and (x 2, y 2 ), te slope of te line troug tese two points is cange

More information

2 The Derivative. 2.0 Introduction to Derivatives. Slopes of Tangent Lines: Graphically

2 The Derivative. 2.0 Introduction to Derivatives. Slopes of Tangent Lines: Graphically 2 Te Derivative Te two previous capters ave laid te foundation for te study of calculus. Tey provided a review of some material you will need and started to empasize te various ways we will view and use

More information

CHAPTER 7: TRANSCENDENTAL FUNCTIONS

CHAPTER 7: TRANSCENDENTAL FUNCTIONS 7.0 Introduction and One to one Functions Contemporary Calculus 1 CHAPTER 7: TRANSCENDENTAL FUNCTIONS Introduction In te previous capters we saw ow to calculate and use te derivatives and integrals of

More information

Hash-Based Indexes. Chapter 11. Comp 521 Files and Databases Spring

Hash-Based Indexes. Chapter 11. Comp 521 Files and Databases Spring Has-Based Indexes Capter 11 Comp 521 Files and Databases Spring 2010 1 Introduction As for any index, 3 alternatives for data entries k*: Data record wit key value k

More information

15-122: Principles of Imperative Computation, Summer 2011 Assignment 6: Trees and Secret Codes

15-122: Principles of Imperative Computation, Summer 2011 Assignment 6: Trees and Secret Codes 15-122: Principles of Imperative Computation, Summer 2011 Assignment 6: Trees and Secret Codes William Lovas (wlovas@cs) Karl Naden Out: Tuesday, Friday, June 10, 2011 Due: Monday, June 13, 2011 (Written

More information

Prelim 1. Solution. CS 2110, 14 March 2017, 7:30 PM Total Question Name Short answer

Prelim 1. Solution. CS 2110, 14 March 2017, 7:30 PM Total Question Name Short answer Prelim 1. Solution CS 2110, 14 March 2017, 7:30 PM 1 2 3 4 5 Total Question Name Short answer OO Recursion Loop invariants Max 1 36 33 15 15 100 Score Grader 1. Name (1 point) Write your name and NetID

More information

Section 2.3: Calculating Limits using the Limit Laws

Section 2.3: Calculating Limits using the Limit Laws Section 2.3: Calculating Limits using te Limit Laws In previous sections, we used graps and numerics to approimate te value of a it if it eists. Te problem wit tis owever is tat it does not always give

More information

Prelim 1. CS 2110, 14 March 2017, 7:30 PM Total Question Name Short answer. OO Recursion Loop invariants Max Score Grader

Prelim 1. CS 2110, 14 March 2017, 7:30 PM Total Question Name Short answer. OO Recursion Loop invariants Max Score Grader Prelim 1 CS 2110, 14 March 2017, 7:30 PM 1 2 3 4 5 Total Question Name Short answer OO Recursion Loop invariants Max 1 36 33 15 15 100 Score Grader The exam is closed ook and closed notes. Do not egin

More information

More on Functions and Their Graphs

More on Functions and Their Graphs More on Functions and Teir Graps Difference Quotient ( + ) ( ) f a f a is known as te difference quotient and is used exclusively wit functions. Te objective to keep in mind is to factor te appearing in

More information

When a BST becomes badly unbalanced, the search behavior can degenerate to that of a sorted linked list, O(N).

When a BST becomes badly unbalanced, the search behavior can degenerate to that of a sorted linked list, O(N). Balanced Binary Trees Binary searc trees provide O(log N) searc times provided tat te nodes are distributed in a reasonably balanced manner. Unfortunately, tat is not always te case and performing a sequence

More information

Hash-Based Indexes. Chapter 11. Comp 521 Files and Databases Fall

Hash-Based Indexes. Chapter 11. Comp 521 Files and Databases Fall Has-Based Indexes Capter 11 Comp 521 Files and Databases Fall 2012 1 Introduction Hasing maps a searc key directly to te pid of te containing page/page-overflow cain Doesn t require intermediate page fetces

More information

Bounding Tree Cover Number and Positive Semidefinite Zero Forcing Number

Bounding Tree Cover Number and Positive Semidefinite Zero Forcing Number Bounding Tree Cover Number and Positive Semidefinite Zero Forcing Number Sofia Burille Mentor: Micael Natanson September 15, 2014 Abstract Given a grap, G, wit a set of vertices, v, and edges, various

More information

Numerical Derivatives

Numerical Derivatives Lab 15 Numerical Derivatives Lab Objective: Understand and implement finite difference approximations of te derivative in single and multiple dimensions. Evaluate te accuracy of tese approximations. Ten

More information

Prelim 1. Solution. CS 2110, 14 March 2017, 5:30 PM Total Question Name Short answer

Prelim 1. Solution. CS 2110, 14 March 2017, 5:30 PM Total Question Name Short answer Prelim 1. Solution CS 2110, 14 March 2017, 5:30 PM 1 2 3 4 5 Total Question Name Short answer OO Recursion Loop invariants Max 1 36 33 15 15 100 Score Grader 1. Name (1 point) Write your name and NetID

More information

2.8 The derivative as a function

2.8 The derivative as a function CHAPTER 2. LIMITS 56 2.8 Te derivative as a function Definition. Te derivative of f(x) istefunction f (x) defined as follows f f(x + ) f(x) (x). 0 Note: tis differs from te definition in section 2.7 in

More information

Prelim 1. CS 2110, 14 March 2017, 5:30 PM Total Question Name Short answer. OO Recursion Loop invariants Max Score Grader

Prelim 1. CS 2110, 14 March 2017, 5:30 PM Total Question Name Short answer. OO Recursion Loop invariants Max Score Grader Prelim 1 CS 2110, 14 March 2017, 5:30 PM 1 2 3 4 5 Total Question Name Short answer OO Recursion Loop invariants Max 1 36 33 15 15 100 Score Grader The exam is closed ook and closed notes. Do not egin

More information

CE 221 Data Structures and Algorithms

CE 221 Data Structures and Algorithms CE Data Structures and Algoritms Capter 4: Trees (AVL Trees) Text: Read Weiss, 4.4 Izmir University of Economics AVL Trees An AVL (Adelson-Velskii and Landis) tree is a binary searc tree wit a balance

More information

Limits and Continuity

Limits and Continuity CHAPTER Limits and Continuit. Rates of Cange and Limits. Limits Involving Infinit.3 Continuit.4 Rates of Cange and Tangent Lines An Economic Injur Level (EIL) is a measurement of te fewest number of insect

More information

1.4 RATIONAL EXPRESSIONS

1.4 RATIONAL EXPRESSIONS 6 CHAPTER Fundamentals.4 RATIONAL EXPRESSIONS Te Domain of an Algebraic Epression Simplifying Rational Epressions Multiplying and Dividing Rational Epressions Adding and Subtracting Rational Epressions

More information

Measuring Length 11and Area

Measuring Length 11and Area Measuring Lengt 11and Area 11.1 Areas of Triangles and Parallelograms 11.2 Areas of Trapezoids, Romuses, and Kites 11.3 Perimeter and Area of Similar Figures 11.4 Circumference and Arc Lengt 11.5 Areas

More information

4.2 The Derivative. f(x + h) f(x) lim

4.2 The Derivative. f(x + h) f(x) lim 4.2 Te Derivative Introduction In te previous section, it was sown tat if a function f as a nonvertical tangent line at a point (x, f(x)), ten its slope is given by te it f(x + ) f(x). (*) Tis is potentially

More information

Materials: Whiteboard, TI-Nspire classroom set, quadratic tangents program, and a computer projector.

Materials: Whiteboard, TI-Nspire classroom set, quadratic tangents program, and a computer projector. Adam Clinc Lesson: Deriving te Derivative Grade Level: 12 t grade, Calculus I class Materials: Witeboard, TI-Nspire classroom set, quadratic tangents program, and a computer projector. Goals/Objectives:

More information

Notes: Dimensional Analysis / Conversions

Notes: Dimensional Analysis / Conversions Wat is a unit system? A unit system is a metod of taking a measurement. Simple as tat. We ave units for distance, time, temperature, pressure, energy, mass, and many more. Wy is it important to ave a standard?

More information

CSCE476/876 Spring Homework 5

CSCE476/876 Spring Homework 5 CSCE476/876 Spring 2016 Assigned on: Friday, Marc 11, 2016 Due: Monday, Marc 28, 2016 Homework 5 Programming assignment sould be submitted wit andin Te report can eiter be submitted wit andin as a PDF,

More information

Haar Transform CS 430 Denbigh Starkey

Haar Transform CS 430 Denbigh Starkey Haar Transform CS Denbig Starkey. Background. Computing te transform. Restoring te original image from te transform 7. Producing te transform matrix 8 5. Using Haar for lossless compression 6. Using Haar

More information

CS 234. Module 6. October 25, CS 234 Module 6 ADT Dictionary 1 / 22

CS 234. Module 6. October 25, CS 234 Module 6 ADT Dictionary 1 / 22 CS 234 Module 6 October 25, 2016 CS 234 Module 6 ADT Dictionary 1 / 22 Case study Problem: Find a way to store student records for a course, wit unique IDs for eac student, were records can be accessed,

More information

A Novel QC-LDPC Code with Flexible Construction and Low Error Floor

A Novel QC-LDPC Code with Flexible Construction and Low Error Floor A Novel QC-LDPC Code wit Flexile Construction and Low Error Floor Hanxin WANG,2, Saoping CHEN,2,CuitaoZHU,2 and Kaiyou SU Department of Electronics and Information Engineering, Sout-Central University

More information

12.2 Techniques for Evaluating Limits

12.2 Techniques for Evaluating Limits 335_qd /4/5 :5 PM Page 863 Section Tecniques for Evaluating Limits 863 Tecniques for Evaluating Limits Wat ou sould learn Use te dividing out tecnique to evaluate its of functions Use te rationalizing

More information

AVL Trees Outline and Required Reading: AVL Trees ( 11.2) CSE 2011, Winter 2017 Instructor: N. Vlajic

AVL Trees Outline and Required Reading: AVL Trees ( 11.2) CSE 2011, Winter 2017 Instructor: N. Vlajic 1 AVL Trees Outline and Required Reading: AVL Trees ( 11.2) CSE 2011, Winter 2017 Instructor: N. Vlajic AVL Trees 2 Binary Searc Trees better tan linear dictionaries; owever, te worst case performance

More information

Areas of Parallelograms and Triangles. To find the area of parallelograms and triangles

Areas of Parallelograms and Triangles. To find the area of parallelograms and triangles 10-1 reas of Parallelograms and Triangles ommon ore State Standards G-MG..1 Use geometric sapes, teir measures, and teir properties to descrie ojects. G-GPE..7 Use coordinates to compute perimeters of

More information

MAC-CPTM Situations Project

MAC-CPTM Situations Project raft o not use witout permission -P ituations Project ituation 20: rea of Plane Figures Prompt teacer in a geometry class introduces formulas for te areas of parallelograms, trapezoids, and romi. e removes

More information

1 Copyright 2012 by Pearson Education, Inc. All Rights Reserved.

1 Copyright 2012 by Pearson Education, Inc. All Rights Reserved. CHAPTER 20 AVL Trees Objectives To know wat an AVL tree is ( 20.1). To understand ow to rebalance a tree using te LL rotation, LR rotation, RR rotation, and RL rotation ( 20.2). To know ow to design te

More information

NOTES: A quick overview of 2-D geometry

NOTES: A quick overview of 2-D geometry NOTES: A quick overview of 2-D geometry Wat is 2-D geometry? Also called plane geometry, it s te geometry tat deals wit two dimensional sapes flat tings tat ave lengt and widt, suc as a piece of paper.

More information

12.2 TECHNIQUES FOR EVALUATING LIMITS

12.2 TECHNIQUES FOR EVALUATING LIMITS Section Tecniques for Evaluating Limits 86 TECHNIQUES FOR EVALUATING LIMITS Wat ou sould learn Use te dividing out tecnique to evaluate its of functions Use te rationalizing tecnique to evaluate its of

More information

7. Graph Algorithms. 7.1 Depth-First Search

7. Graph Algorithms. 7.1 Depth-First Search 7. Grap Algoritms Te previous capters ave examined a numer o grap prolems and teir algoritms in te context o design tecniques. In tis capter, we examine additional undamental grap prolems. In te irst two

More information

HW 2 Bench Table. Hash Indexes: Chap. 11. Table Bench is in tablespace setq. Loading table bench. Then a bulk load

HW 2 Bench Table. Hash Indexes: Chap. 11. Table Bench is in tablespace setq. Loading table bench. Then a bulk load Has Indexes: Cap. CS64 Lecture 6 HW Benc Table Table of M rows, Columns of different cardinalities CREATE TABLE BENCH ( KSEQ integer primary key, K5K integer not null, K5K integer not null, KK integer

More information

Our Calibrated Model has No Predictive Value: An Example from the Petroleum Industry

Our Calibrated Model has No Predictive Value: An Example from the Petroleum Industry Our Calibrated Model as No Predictive Value: An Example from te Petroleum Industry J.N. Carter a, P.J. Ballester a, Z. Tavassoli a and P.R. King a a Department of Eart Sciences and Engineering, Imperial

More information

, 1 1, A complex fraction is a quotient of rational expressions (including their sums) that result

, 1 1, A complex fraction is a quotient of rational expressions (including their sums) that result RT. Complex Fractions Wen working wit algebraic expressions, sometimes we come across needing to simplify expressions like tese: xx 9 xx +, xx + xx + xx, yy xx + xx + +, aa Simplifying Complex Fractions

More information

CSE 332: Data Structures & Parallelism Lecture 8: AVL Trees. Ruth Anderson Winter 2019

CSE 332: Data Structures & Parallelism Lecture 8: AVL Trees. Ruth Anderson Winter 2019 CSE 2: Data Structures & Parallelism Lecture 8: AVL Trees Rut Anderson Winter 29 Today Dictionaries AVL Trees /25/29 2 Te AVL Balance Condition: Left and rigt subtrees of every node ave eigts differing

More information

Two Modifications of Weight Calculation of the Non-Local Means Denoising Method

Two Modifications of Weight Calculation of the Non-Local Means Denoising Method Engineering, 2013, 5, 522-526 ttp://dx.doi.org/10.4236/eng.2013.510b107 Publised Online October 2013 (ttp://www.scirp.org/journal/eng) Two Modifications of Weigt Calculation of te Non-Local Means Denoising

More information

13.5 DIRECTIONAL DERIVATIVES and the GRADIENT VECTOR

13.5 DIRECTIONAL DERIVATIVES and the GRADIENT VECTOR 13.5 Directional Derivatives and te Gradient Vector Contemporary Calculus 1 13.5 DIRECTIONAL DERIVATIVES and te GRADIENT VECTOR Directional Derivatives In Section 13.3 te partial derivatives f x and f

More information

Implementation of Integral based Digital Curvature Estimators in DGtal

Implementation of Integral based Digital Curvature Estimators in DGtal Implementation of Integral based Digital Curvature Estimators in DGtal David Coeurjolly 1, Jacques-Olivier Lacaud 2, Jérémy Levallois 1,2 1 Université de Lyon, CNRS INSA-Lyon, LIRIS, UMR5205, F-69621,

More information

Algebra Area of Triangles

Algebra Area of Triangles LESSON 0.3 Algera Area of Triangles FOCUS COHERENCE RIGOR LESSON AT A GLANCE F C R Focus: Common Core State Standards Learning Ojective 6.G.A. Find te area of rigt triangles, oter triangles, special quadrilaterals,

More information

Multi-Stack Boundary Labeling Problems

Multi-Stack Boundary Labeling Problems Multi-Stack Boundary Labeling Problems Micael A. Bekos 1, Micael Kaufmann 2, Katerina Potika 1 Antonios Symvonis 1 1 National Tecnical University of Atens, Scool of Applied Matematical & Pysical Sciences,

More information

Symmetric Tree Replication Protocol for Efficient Distributed Storage System*

Symmetric Tree Replication Protocol for Efficient Distributed Storage System* ymmetric Tree Replication Protocol for Efficient Distributed torage ystem* ung Cune Coi 1, Hee Yong Youn 1, and Joong up Coi 2 1 cool of Information and Communications Engineering ungkyunkwan University

More information

Classify solids. Find volumes of prisms and cylinders.

Classify solids. Find volumes of prisms and cylinders. 11.4 Volumes of Prisms and Cylinders Essential Question How can you find te volume of a prism or cylinder tat is not a rigt prism or rigt cylinder? Recall tat te volume V of a rigt prism or a rigt cylinder

More information

THANK YOU FOR YOUR PURCHASE!

THANK YOU FOR YOUR PURCHASE! THANK YOU FOR YOUR PURCHASE! Te resources included in tis purcase were designed and created by me. I ope tat you find tis resource elpful in your classroom. Please feel free to contact me wit any questions

More information

2.5 Evaluating Limits Algebraically

2.5 Evaluating Limits Algebraically SECTION.5 Evaluating Limits Algebraically 3.5 Evaluating Limits Algebraically Preinary Questions. Wic of te following is indeterminate at x? x C x ; x x C ; x x C 3 ; x C x C 3 At x, x isofteform 0 xc3

More information

Fast Calculation of Thermodynamic Properties of Water and Steam in Process Modelling using Spline Interpolation

Fast Calculation of Thermodynamic Properties of Water and Steam in Process Modelling using Spline Interpolation P R E P R N T CPWS XV Berlin, September 8, 008 Fast Calculation of Termodynamic Properties of Water and Steam in Process Modelling using Spline nterpolation Mattias Kunick a, Hans-Joacim Kretzscmar a,

More information

Section 1.2 The Slope of a Tangent

Section 1.2 The Slope of a Tangent Section 1.2 Te Slope of a Tangent You are familiar wit te concept of a tangent to a curve. Wat geometric interpretation can be given to a tangent to te grap of a function at a point? A tangent is te straigt

More information

CS 1110: Introduction to Computing Using Python Loop Invariants

CS 1110: Introduction to Computing Using Python Loop Invariants CS 1110: Introduction to Computing Using Python Lecture 21 Loop Invariants [Andersen, Gries, Lee, Marschner, Van Loan, White] Announcements Prelim 2 conflicts due by midnight tonight Lab 11 is out Due

More information

Redundancy Awareness in SQL Queries

Redundancy Awareness in SQL Queries Redundancy Awareness in QL Queries Bin ao and Antonio Badia omputer Engineering and omputer cience Department University of Louisville bin.cao,abadia @louisville.edu Abstract In tis paper, we study QL

More information

Optimal In-Network Packet Aggregation Policy for Maximum Information Freshness

Optimal In-Network Packet Aggregation Policy for Maximum Information Freshness 1 Optimal In-etwork Packet Aggregation Policy for Maimum Information Fresness Alper Sinan Akyurek, Tajana Simunic Rosing Electrical and Computer Engineering, University of California, San Diego aakyurek@ucsd.edu,

More information

Lecture 7. Binary Search Trees / AVL Trees

Lecture 7. Binary Search Trees / AVL Trees Lecture 7. Binary Searc Trees / AVL Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algoritms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Coo coo@skku.edu Copyrigt

More information

SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY

SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY 1 A3 and Prelim 2 SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY Lecture 11 CS2110 Fall 2016 Deadline for A3: tonight. Only two late days allowed (Wed-Thur) Prelim: Thursday evening. 74 conflicts! If you

More information

CORRECTNESS ISSUES AND LOOP INVARIANTS

CORRECTNESS ISSUES AND LOOP INVARIANTS The next everal lecture 2 Study algorithm for earching and orting array. Invetigate their complexity how much time and pace they take Formalize the notion of average-cae and wort-cae complexity CORRECTNESS

More information

Coarticulation: An Approach for Generating Concurrent Plans in Markov Decision Processes

Coarticulation: An Approach for Generating Concurrent Plans in Markov Decision Processes Coarticulation: An Approac for Generating Concurrent Plans in Markov Decision Processes Kasayar Roanimanes kas@cs.umass.edu Sridar Maadevan maadeva@cs.umass.edu Department of Computer Science, University

More information

Wrap up Amortized Analysis; AVL Trees. Riley Porter Winter CSE373: Data Structures & Algorithms

Wrap up Amortized Analysis; AVL Trees. Riley Porter Winter CSE373: Data Structures & Algorithms CSE 373: Data Structures & Wrap up Amortized Analysis; AVL Trees Riley Porter Course Logistics Symposium offered by CSE department today HW2 released, Big- O, Heaps (lecture slides ave pseudocode tat will

More information

Design Patterns for Data Structures. Chapter 10. Balanced Trees

Design Patterns for Data Structures. Chapter 10. Balanced Trees Capter 10 Balanced Trees Capter 10 Four eigt-balanced trees: Red-Black binary tree Faster tan AVL for insertion and removal Adelsen-Velskii Landis (AVL) binary tree Faster tan red-black for lookup B-tree

More information

Announcements. Lilian s office hours rescheduled: Fri 2-4pm HW2 out tomorrow, due Thursday, 7/7. CSE373: Data Structures & Algorithms

Announcements. Lilian s office hours rescheduled: Fri 2-4pm HW2 out tomorrow, due Thursday, 7/7. CSE373: Data Structures & Algorithms Announcements Lilian s office ours resceduled: Fri 2-4pm HW2 out tomorrow, due Tursday, 7/7 CSE373: Data Structures & Algoritms Deletion in BST 2 5 5 2 9 20 7 0 7 30 Wy migt deletion be arder tan insertion?

More information

6 Computing Derivatives the Quick and Easy Way

6 Computing Derivatives the Quick and Easy Way Jay Daigle Occiental College Mat 4: Calculus Experience 6 Computing Derivatives te Quick an Easy Way In te previous section we talke about wat te erivative is, an we compute several examples, an ten we

More information

5.4 Sum and Difference Formulas

5.4 Sum and Difference Formulas 380 Capter 5 Analtic Trigonometr 5. Sum and Difference Formulas Using Sum and Difference Formulas In tis section and te following section, ou will stud te uses of several trigonometric identities and formulas.

More information

3.6 Directional Derivatives and the Gradient Vector

3.6 Directional Derivatives and the Gradient Vector 288 CHAPTER 3. FUNCTIONS OF SEVERAL VARIABLES 3.6 Directional Derivatives and te Gradient Vector 3.6.1 Functions of two Variables Directional Derivatives Let us first quickly review, one more time, te

More information

Some Handwritten Signature Parameters in Biometric Recognition Process

Some Handwritten Signature Parameters in Biometric Recognition Process Some Handwritten Signature Parameters in Biometric Recognition Process Piotr Porwik Institute of Informatics, Silesian Uniersity, Bdziska 39, 41- Sosnowiec, Poland porwik@us.edu.pl Tomasz Para Institute

More information

Introduction to Computer Graphics 5. Clipping

Introduction to Computer Graphics 5. Clipping Introduction to Computer Grapics 5. Clipping I-Cen Lin, Assistant Professor National Ciao Tung Univ., Taiwan Textbook: E.Angel, Interactive Computer Grapics, 5 t Ed., Addison Wesley Ref:Hearn and Baker,

More information

ASYMPTOTIC COMPLEXITY

ASYMPTOTIC COMPLEXITY Simplicity is a great virtue but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better. - Edsger Dijkstra ASYMPTOTIC COMPLEXITY Lecture

More information

CESILA: Communication Circle External Square Intersection-Based WSN Localization Algorithm

CESILA: Communication Circle External Square Intersection-Based WSN Localization Algorithm Sensors & Transducers 2013 by IFSA ttp://www.sensorsportal.com CESILA: Communication Circle External Square Intersection-Based WSN Localization Algoritm Sun Hongyu, Fang Ziyi, Qu Guannan College of Computer

More information

Design Patterns for Data Structures. Chapter 10. Balanced Trees

Design Patterns for Data Structures. Chapter 10. Balanced Trees Capter 10 Balanced Trees Capter 10 Four eigt-balanced trees: Red-Black binary tree Faster tan AVL for insertion and removal Adelsen-Velskii Landis (AVL) binary tree Faster tan red-black for lookup B-tree

More information

What s the Difference?

What s the Difference? 1 Wat s te Difference? A Functional Pearl on Subtracting Bijections BRENT A. YORGEY, Hendrix College, USA KENNETH FONER, University of Pennsylvania, USA It is a straigtforward exercise to write a program

More information

1 Finding Trigonometric Derivatives

1 Finding Trigonometric Derivatives MTH 121 Fall 2008 Essex County College Division of Matematics Hanout Version 8 1 October 2, 2008 1 Fining Trigonometric Derivatives 1.1 Te Derivative as a Function Te efinition of te erivative as a function

More information

Linear Interpolating Splines

Linear Interpolating Splines Jim Lambers MAT 772 Fall Semester 2010-11 Lecture 17 Notes Tese notes correspond to Sections 112, 11, and 114 in te text Linear Interpolating Splines We ave seen tat ig-degree polynomial interpolation

More information

JPEG Serial Camera Module. OV528 Protocol

JPEG Serial Camera Module. OV528 Protocol JPEG Serial Camera Module OV528 Protocol LCF-23M1 32mmx32mm or 38mmx38mm LCF-23MA 32mm-38mm Default baudrate 9600bps~115200 bps Auto adaptive 9600bps~115200 bps Page 1 of 15 1.General Description OV528

More information

You should be able to visually approximate the slope of a graph. The slope m of the graph of f at the point x, f x is given by

You should be able to visually approximate the slope of a graph. The slope m of the graph of f at the point x, f x is given by Section. Te Tangent Line Problem 89 87. r 5 sin, e, 88. r sin sin Parabola 9 9 Hperbola e 9 9 9 89. 7,,,, 5 7 8 5 ortogonal 9. 5, 5,, 5, 5. Not multiples of eac oter; neiter parallel nor ortogonal 9.,,,

More information

MTH-112 Quiz 1 - Solutions

MTH-112 Quiz 1 - Solutions MTH- Quiz - Solutions Words in italics are for eplanation purposes onl (not necessar to write in te tests or. Determine weter te given relation is a function. Give te domain and range of te relation. {(,

More information

All truths are easy to understand once they are discovered; the point is to discover them. Galileo

All truths are easy to understand once they are discovered; the point is to discover them. Galileo Section 7. olume All truts are easy to understand once tey are discovered; te point is to discover tem. Galileo Te main topic of tis section is volume. You will specifically look at ow to find te volume

More information

When the dimensions of a solid increase by a factor of k, how does the surface area change? How does the volume change?

When the dimensions of a solid increase by a factor of k, how does the surface area change? How does the volume change? 8.4 Surface Areas and Volumes of Similar Solids Wen te dimensions of a solid increase by a factor of k, ow does te surface area cange? How does te volume cange? 1 ACTIVITY: Comparing Surface Areas and

More information

Investigating an automated method for the sensitivity analysis of functions

Investigating an automated method for the sensitivity analysis of functions Investigating an automated metod for te sensitivity analysis of functions Sibel EKER s.eker@student.tudelft.nl Jill SLINGER j..slinger@tudelft.nl Delft University of Tecnology 2628 BX, Delft, te Neterlands

More information

Models & Implementations

Models & Implementations :* :+ Legend: :* :+ Legend: 72 Intro to Programming and Algoritms 2 (Adv.) 215 Uwe R. Zimmer - Te Australian National University 74 Algebraic types foundations: Recursive types Lists Verbal definition:

More information

Proceedings of the 8th WSEAS International Conference on Neural Networks, Vancouver, British Columbia, Canada, June 19-21,

Proceedings of the 8th WSEAS International Conference on Neural Networks, Vancouver, British Columbia, Canada, June 19-21, Proceedings of te 8t WSEAS International Conference on Neural Networks, Vancouver, Britis Columbia, Canada, June 9-2, 2007 3 Neural Network Structures wit Constant Weigts to Implement Dis-Jointly Removed

More information

z = x 2 xy + y 2 clf // c6.1(2)contour Change to make a contour plot of z=xy.

z = x 2 xy + y 2 clf // c6.1(2)contour Change to make a contour plot of z=xy. 190 Lecture 6 3D equations formatting Open Lecture 6. See Capter 3, 10 of text for details. Draw a contour grap and a 3D grap of z = 1 x 2 y 2 = an upper emispere. For Classwork 1 and 2, you will grap

More information

Software Fault Prediction using Machine Learning Algorithm Pooja Garg 1 Mr. Bhushan Dua 2

Software Fault Prediction using Machine Learning Algorithm Pooja Garg 1 Mr. Bhushan Dua 2 IJSRD - International Journal for Scientific Researc & Development Vol. 3, Issue 04, 2015 ISSN (online): 2321-0613 Software Fault Prediction using Macine Learning Algoritm Pooja Garg 1 Mr. Busan Dua 2

More information

MAPI Computer Vision

MAPI Computer Vision MAPI Computer Vision Multiple View Geometry In tis module we intend to present several tecniques in te domain of te 3D vision Manuel Joao University of Mino Dep Industrial Electronics - Applications -

More information

CS842: Automatic Memory Management and Garbage Collection. GC basics

CS842: Automatic Memory Management and Garbage Collection. GC basics CS842: Automatic Memory Management and Garbage Collection GC basics 1 Review Noting mmap (space allocated) Mapped space Wile owned by program, manager as no reference! malloc (object created) Never returned

More information

Tuning MAX MIN Ant System with off-line and on-line methods

Tuning MAX MIN Ant System with off-line and on-line methods Université Libre de Bruxelles Institut de Recerces Interdisciplinaires et de Développements en Intelligence Artificielle Tuning MAX MIN Ant System wit off-line and on-line metods Paola Pellegrini, Tomas

More information

Design of Map Decomposition and Wiimote-based Localization for Vacuuming Robots

Design of Map Decomposition and Wiimote-based Localization for Vacuuming Robots Design of Map Decomposition and Wiimote-based Localization for Vacuuming Robots Cia-Pin Kuo, Sy-In Hwang Department of Computer Science and Engineering Yuan Ze University s956007@mail.yzu.edu.tw, syin@cs.yzu.edu.tw

More information

PLK-B SERIES Technical Manual (USA Version) CLICK HERE FOR CONTENTS

PLK-B SERIES Technical Manual (USA Version) CLICK HERE FOR CONTENTS PLK-B SERIES Technical Manual (USA Version) CLICK ERE FOR CONTENTS CONTROL BOX PANEL MOST COMMONLY USED FUNCTIONS INITIAL READING OF SYSTEM SOFTWARE/PAGES 1-2 RE-INSTALLATION OF TE SYSTEM SOFTWARE/PAGES

More information

Binary Search Tree - Best Time. AVL Trees. Binary Search Tree - Worst Time. Balanced and unbalanced BST

Binary Search Tree - Best Time. AVL Trees. Binary Search Tree - Worst Time. Balanced and unbalanced BST AL Trees CSE Data Structures Unit Reading: Section 4.4 Binary Searc Tree - Best Time All BST operations are O(d), were d is tree dept minimum d is d = log for a binary tree N wit N nodes at is te best

More information

Density Estimation Over Data Stream

Density Estimation Over Data Stream Density Estimation Over Data Stream Aoying Zou Dept. of Computer Science, Fudan University 22 Handan Rd. Sangai, 2433, P.R. Cina ayzou@fudan.edu.cn Ziyuan Cai Dept. of Computer Science, Fudan University

More information

Read pages in the book, up to the investigation. Pay close attention to Example A and how to identify the height.

Read pages in the book, up to the investigation. Pay close attention to Example A and how to identify the height. C 8 Noteseet L Key In General ON LL PROBLEMS!!. State te relationsip (or te formula).. Sustitute in known values. 3. Simplify or Solve te equation. Use te order of operations in te correct order. Order

More information

You Try: A. Dilate the following figure using a scale factor of 2 with center of dilation at the origin.

You Try: A. Dilate the following figure using a scale factor of 2 with center of dilation at the origin. 1 G.SRT.1-Some Tings To Know Dilations affect te size of te pre-image. Te pre-image will enlarge or reduce by te ratio given by te scale factor. A dilation wit a scale factor of 1> x >1enlarges it. A dilation

More information

M2TECH HIFACE DAC 384KHZ/32BIT DIGITAL-TO-ANALOG CONVERTER USER MANUAL

M2TECH HIFACE DAC 384KHZ/32BIT DIGITAL-TO-ANALOG CONVERTER USER MANUAL M2TECH HIFACE DAC 384KHZ/32BIT DIGITAL-TO-ANALOG CONVERTER USER MANUAL REV. 1.1 5/2013 Warning! Canges or modifications not autorized by te manufacturer can invalidate te compliance to CE regulations and

More information