Example: Is a string a palindrome? Recursion. Count the e s in a string. Recursion as a math technique 12/02/2013. Example: Sum the digits in a number
|
|
- Candace Pearson
- 7 years ago
- Views:
Transcription
1 Example: Sum the digits i a umber /** retur sum of digits i, give >= 0 */ public static it sum(it ) { if ( < 0) retur ; sum calls itself! // has at least two digits: // retur first digit + sum of rest retur %0 + sum(/0); Lecture 6 CS0 Sprig 03 RECURSION E.g. sum(870) = +(+(0+(7+8))) 8 Recursio Arises i three forms i computer sciece Recursio as a mathematical tool for defiig a fuctio i terms of its ow value i a simpler case Recursio as a programmig tool. You ve see this previously but we ll take it to mid-bedig extremes (by the ed of the class it will seem easy!) 5 Example: Is a strig a palidrome? /** = "s is a palidrome" */ public static boolea ispalidrome(strig s) { if (s.legth() <) retur true; Substrig from char() to char(-) // s has at least chars it = s.legth()-; retur s.charat(0) == s.charat() && ispalidrome(s.substrig(, )); Recursio used to prove properties about algorithms. We use the term iductio for this ad will discuss it later. ispalidrome( racecar ) = true ispalidrome( pumpki ) = false r a c e c a r a c e c a c e c e 3 Recursio as a math techique Broadly, recursio is a powerful techique for specifyig fuctios, sets, ad programs A few recursively-defied fuctios ad programs factorial combiatios expoetiatio (raisig to a iteger power) Some recursively-defied sets grammars expressios data structures (lists, trees,...) 6 Cout the e s i a strig /** = " umber of times c occurs i s */ public static it coutem(char c, Strig s) { if (s.legth() == 0) retur 0; // { s has at least character if (s.charat(0)!= c) retur coutem(c, s.substrig()); // { first character of s is c retur + coutem (c, s.substrig()); coutem( e, it is easy to see that this has may e s ) = coutem( e, Mississippi ) = 0 Substrig from char() to ed
2 The Factorial Fuctio (!) Observatio 7 0 Defie! = () () 3 read: factorial E.g., 3! = 3 = 6 By covetio, 0! The fuctio it it that gives! o iput is called the factorial fuctio Oe way to thik about the task of permutig the four colored blocks was to start by computig all permutatios of three blocks, the fidig all ways to add a fourth block Ad this explais why the umber of permutatios turs out to be! Ca geeralize to prove that the umber of permutatios of blocks is! The Factorial Fuctio (!) A Recursive Program 8! is the umber of permutatios of distict objects There is just oe permutatio of oe object.! There are two permutatios of two objects:! = There are six permutatios of three objects: 3! = If > 0,! = ( )! 0!! = ()!, > 0 static it fact(it ) { if ( = = 0) retur ; else retur *fact(-); Executio of fact() fact() fact(3) fact() fact() fact(0) 6 Permutatios of Geeral Approach to Writig Recursive Fuctios 9 Permutatios of o-orage blocks. Try to fid a parameter, say, such that the solutio for ca be obtaied by combiig solutios to the same problem usig smaller values of (e.g., (-) i our factorial example). Fid base case(s) small values of for which you ca just write dow the solutio (e.g., 0! ) Each permutatio of the three oorage blocks gives four permutatios whe the orage block is icluded 3. Verify that, for ay valid value of, applyig the reductio of step repeatedly will ultimately hit oe of the base cases Total umber = 3! = 6 = :!
3 3 A cautioary ote Keep i mid that each istace of your recursive fuctio has its ow local variables Also, remember that higher istaces are waitig while lower istaces ru Not such a good idea to touch global variables from withi recursive fuctios Legal but a commo source of errors Must have a really clear metal picture of how recursio is performed to get this right! 6 Oe thig to otice This way of computig the Fiboacci fuctio is elegat, but iefficiet It recomputes aswers agai ad agai! To improve speed, eed to save kow aswers i a table! fib() Oe etry per aswer fib() fib(3) Such a table is called a cache fib(0) fib() fib() fib() fib(0) fib() The Fiboacci Fuctio Memoizatio (facy term for cachig ) Mathematical defiitio: fib(0) = 0 two base cases! fib() fib() = fib( ) + fib( ), Fiboacci sequece: 0,,,, 3, 5, 8, 3, static it fib(it ) { if ( == 0) retur 0; else if ( =) retur ; else retur fib(-) + fib(-); Fiboacci (Leoardo Pisao) 700? Statue i Pisa, Italy Giovai Pagaucci Memoizatio is a optimizatio techique used to speed up computer programs by havig fuctio calls avoid repeatig the calculatio of results for previously processed iputs. The first time the fuctio is called, we save result The ext time, we ca look the result up Assumes a side effect free fuctio: The fuctio just computes the result, it does t chage thigs If the fuctio depeds o aythig that chages, must empty the saved results list 5 Recursive Executio static it fib(it ) { if ( == 0) retur 0; else if ( =) retur ; else retur fib(-) + fib(-); Executio of fib(): fib(0) fib() fib() fib() fib() fib(3) fib(0) fib() fib() 8 Addig Memoizatio to our solutio Before: After static ArrayList<Iteger> cached = ew ArrayList<Iteger>(); static it fib(it ) { if ( == 0) static it fib(it ) { retur 0; if( < cached.size()) else if ( =) retur cached.get(); retur ; it v; else if ( == 0) retur fib(-) + fib(-); v = 0; else if ( =) v ; else v = fib(-) + fib(-); // cached[] = fib(). This code makes use of the fact // that a ArrayList adds elemets to the ed of the list if( == cached.size()) cached.add(v); retur v; 3
4 9 Notice the developmet process We started with the idea of recursio Created a very simple recursive procedure Noticed it will be slow, because it wastefully recomputes the same thig agai ad agai So made it a bit more complex but gaied a lot of speed i doig so This is a commo software egieerig patter A Smarter Versio Power computatio: a0 If is ozero ad eve, a = (a/) If is odd, a = a (a/) Java ote: If x ad y are itegers, x/y returs the iteger part of the quotiet Example: a5 = a (a5/) = a (a) = a ((a/)) = a (a) Note: this requires 3 multiplicatios rather tha 5! Why did it work? A Smarter Versio 0 This cached list works because for each value of, either cached.get() is still udefied, or has fib() Takes advatage of the fact that a ArrayList adds elemets at the ed, ad idexes from 0 cached@ba8900, size=5 0 3 cached.get(0)=0 cached.get()= cached.get()=fib() Property of our code: cached.get() accessed after fib() computed 3 Example: a5 = a (a5/) = a (a) = a ((a/)) = a (a) Note: this requires 3 multiplicatios rather tha 5! What if were larger? Savigs would be more sigificat This is much faster tha the straightforward computatio Straightforward computatio: multiplicatios Smarter computatio: log() multiplicatios Positive Iteger Powers a = a a a a ( times) Alterate descriptio: a 0 a + = a a static it power(it a, it ) { if ( == 0) retur ; else retur a*power(a,-); Smarter Versio i Java = 0: a 0 ozero ad eve: a = (a / ) ozero ad odd: a = a (a / ) local variable parameters static it power(it a, it ) { if ( == 0) retur ; it halfpower = power(a,/); if (% == 0) retur halfpower*halfpower; retur halfpower*halfpower*a; The method has two parameters ad a local variable Why are t these overwritte o recursive calls?
5 How Java compiles recursive code Example: power(, 5) 5 Key idea: Java uses a stack to remember parameters ad local variables across recursive calls Each method ivocatio gets its ow stack frame A stack frame cotais storage for Local variables of method Parameters of method Retur ifo (retur address ad retur value) Perhaps other bookkeepig ifo 8 hp: short for halfpower ( = ) 5 ( = ) ( = ) 5 ( = ) ( = ) ( = ) 5 (retval = ) (hp = ) ( = ) ( = ) ( = ) 5 (retval = ) (hp = ) ( = ) ( = ) 5 (retval = ) (hp = ) ( = ) 5 (retval = ) 3 6 Stacks 9 How Do We Keep Track? stack grows top elemet d elemet 3rd elemet bottom elemet top-of-stack poiter Like a stack of dier plates You ca push data o top or pop data off the top i a LIFO (last-i-first-out) fashio A queue is similar, except it is FIFO (first-i-first-out) May frames may exist, but computatio is oly occurrig i the top frame The oes below it are waitig for results The hardware has ice support for this way of implemetig fuctio calls, ad recursio is just a kid of fuctio call 7 Stack Frame A ew stack frame is pushed with each recursive call The stack frame is popped whe the method returs Leavig a retur value (if there is oe) o top of the stack a stack frame halfpower local variables a, parameters retval 30 Coclusio Recursio is a coveiet ad powerful way to defie fuctios Problems that seem isurmoutable ca ofte be solved i a divide-ad-coquer fashio: Reduce a big problem to smaller problems of the same kid, solve the smaller problems Recombie the solutios to smaller problems to form solutio for big problem Importat applicatio (ext lecture): parsig 5
6 3 Extra slides 3 Biomial Coefficiets For use if we have time for oe more example of recursio This builds o the ideas i the Fiboacci example Combiatios are also called biomial coefficiets because they appear as coefficiets i the expasio of the biomial power (x+y) : (x + y) = x + x y + x y ( 0 ) ( ) + + ( ) y = ( i ) x i y i i= 0 3 Combiatios (a.k.a. Biomial Coefficiets) Combiatios Have Two Base Cases 3 How may ways ca you choose r items from a set of distict elemets? ( ) choose r r 5 ( ) = umber of -elemet subsets of {A,B,C,D,E -elemet subsets cotaiig A: {A,B, {A,C, {A,D, {A,E ( ) -elemet subsets ot cotaiig A: {B,C,{B,D,{B,E,{C,D,{C,E,{D,E Therefore, 5 = + ( ) i perfect form to write a recursive fuctio! 35 ( r ) = ( r ) + ( r ), > r > 0 ( ) Two base cases Comig up with right base cases ca be tricky! Geeral idea: Determie argumet values for which recursive case does ot apply Itroduce a base case for each oe of these 33 Combiatios ( r ) = ( r ) + ( r ), > r > 0 ( ) 0 ( ) ( ) ( ) ( 3) ( ) ( 3) Ca also show that ( r ) = ( ) Pascal s triagle =! r!(r)! Recursive Program for Combiatios ( r ) = ( r ) + ( r ), > r > 0 ( ) static it combs(it, it r) { //assume >=r>=0 if (r == 0 r == ) retur ; //base cases else retur combs(-,r) + combs(-,r-); 6
7 Exercise for the reader (you!) 37 Modify our recursive program so that it caches results Same idea as for our cachig versio of the fiboacci series Questio to poder: Whe is it worthwhile to addig cachig to a recursive fuctio? Certaily ot always Must thik about tradeoffs: space to maitai the cached results vs speedup obtaied by havig them Somethig to thik about 38 With fib(), it was kid of a trick to arrage that: cached[]=fib() Cachig combiatorial values will force you to store more tha just the aswer: Create a class called Triple Desig it to have iteger fields, r, v Store Triple objects ito ArrayList<Triple> cached; Search cached for a saved value matchig ad r Hit: use a foreach loop 7
SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES
SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES Read Sectio 1.5 (pages 5 9) Overview I Sectio 1.5 we lear to work with summatio otatio ad formulas. We will also itroduce a brief overview of sequeces,
More informationExample 2 Find the square root of 0. The only square root of 0 is 0 (since 0 is not positive or negative, so those choices don t exist here).
BEGINNING ALGEBRA Roots ad Radicals (revised summer, 00 Olso) Packet to Supplemet the Curret Textbook - Part Review of Square Roots & Irratioals (This portio ca be ay time before Part ad should mostly
More informationBINOMIAL EXPANSIONS 12.5. In this section. Some Examples. Obtaining the Coefficients
652 (12-26) Chapter 12 Sequeces ad Series 12.5 BINOMIAL EXPANSIONS I this sectio Some Examples Otaiig the Coefficiets The Biomial Theorem I Chapter 5 you leared how to square a iomial. I this sectio you
More informationInfinite Sequences and Series
CHAPTER 4 Ifiite Sequeces ad Series 4.1. Sequeces A sequece is a ifiite ordered list of umbers, for example the sequece of odd positive itegers: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29...
More informationTHE ARITHMETIC OF INTEGERS. - multiplication, exponentiation, division, addition, and subtraction
THE ARITHMETIC OF INTEGERS - multiplicatio, expoetiatio, divisio, additio, ad subtractio What to do ad what ot to do. THE INTEGERS Recall that a iteger is oe of the whole umbers, which may be either positive,
More informationSoving Recurrence Relations
Sovig Recurrece Relatios Part 1. Homogeeous liear 2d degree relatios with costat coefficiets. Cosider the recurrece relatio ( ) T () + at ( 1) + bt ( 2) = 0 This is called a homogeeous liear 2d degree
More informationIn nite Sequences. Dr. Philippe B. Laval Kennesaw State University. October 9, 2008
I ite Sequeces Dr. Philippe B. Laval Keesaw State Uiversity October 9, 2008 Abstract This had out is a itroductio to i ite sequeces. mai de itios ad presets some elemetary results. It gives the I ite Sequeces
More informationLecture 4: Cauchy sequences, Bolzano-Weierstrass, and the Squeeze theorem
Lecture 4: Cauchy sequeces, Bolzao-Weierstrass, ad the Squeeze theorem The purpose of this lecture is more modest tha the previous oes. It is to state certai coditios uder which we are guarateed that limits
More informationHow To Solve The Homewor Problem Beautifully
Egieerig 33 eautiful Homewor et 3 of 7 Kuszmar roblem.5.5 large departmet store sells sport shirts i three sizes small, medium, ad large, three patters plaid, prit, ad stripe, ad two sleeve legths log
More information1. MATHEMATICAL INDUCTION
1. MATHEMATICAL INDUCTION EXAMPLE 1: Prove that for ay iteger 1. Proof: 1 + 2 + 3 +... + ( + 1 2 (1.1 STEP 1: For 1 (1.1 is true, sice 1 1(1 + 1. 2 STEP 2: Suppose (1.1 is true for some k 1, that is 1
More informationCS103A Handout 23 Winter 2002 February 22, 2002 Solving Recurrence Relations
CS3A Hadout 3 Witer 00 February, 00 Solvig Recurrece Relatios Itroductio A wide variety of recurrece problems occur i models. Some of these recurrece relatios ca be solved usig iteratio or some other ad
More informationSequences and Series
CHAPTER 9 Sequeces ad Series 9.. Covergece: Defiitio ad Examples Sequeces The purpose of this chapter is to itroduce a particular way of geeratig algorithms for fidig the values of fuctios defied by their
More informationCS103X: Discrete Structures Homework 4 Solutions
CS103X: Discrete Structures Homewor 4 Solutios Due February 22, 2008 Exercise 1 10 poits. Silico Valley questios: a How may possible six-figure salaries i whole dollar amouts are there that cotai at least
More informationTrigonometric Form of a Complex Number. The Complex Plane. axis. ( 2, 1) or 2 i FIGURE 6.44. The absolute value of the complex number z a bi is
0_0605.qxd /5/05 0:45 AM Page 470 470 Chapter 6 Additioal Topics i Trigoometry 6.5 Trigoometric Form of a Complex Number What you should lear Plot complex umbers i the complex plae ad fid absolute values
More information5 Boolean Decision Trees (February 11)
5 Boolea Decisio Trees (February 11) 5.1 Graph Coectivity Suppose we are give a udirected graph G, represeted as a boolea adjacecy matrix = (a ij ), where a ij = 1 if ad oly if vertices i ad j are coected
More informationDepartment of Computer Science, University of Otago
Departmet of Computer Sciece, Uiversity of Otago Techical Report OUCS-2006-09 Permutatios Cotaiig May Patters Authors: M.H. Albert Departmet of Computer Sciece, Uiversity of Otago Micah Colema, Rya Fly
More information5.3. Generalized Permutations and Combinations
53 GENERALIZED PERMUTATIONS AND COMBINATIONS 73 53 Geeralized Permutatios ad Combiatios 53 Permutatios with Repeated Elemets Assume that we have a alphabet with letters ad we wat to write all possible
More informationRepeating Decimals are decimal numbers that have number(s) after the decimal point that repeat in a pattern.
5.5 Fractios ad Decimals Steps for Chagig a Fractio to a Decimal. Simplify the fractio, if possible. 2. Divide the umerator by the deomiator. d d Repeatig Decimals Repeatig Decimals are decimal umbers
More informationDiscrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 13
EECS 70 Discrete Mathematics ad Probability Theory Sprig 2014 Aat Sahai Note 13 Itroductio At this poit, we have see eough examples that it is worth just takig stock of our model of probability ad may
More informationHere are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.
This documet was writte ad copyrighted by Paul Dawkis. Use of this documet ad its olie versio is govered by the Terms ad Coditios of Use located at http://tutorial.math.lamar.edu/terms.asp. The olie versio
More informationA Recursive Formula for Moments of a Binomial Distribution
A Recursive Formula for Momets of a Biomial Distributio Árpád Béyi beyi@mathumassedu, Uiversity of Massachusetts, Amherst, MA 01003 ad Saverio M Maago smmaago@psavymil Naval Postgraduate School, Moterey,
More informationIncremental calculation of weighted mean and variance
Icremetal calculatio of weighted mea ad variace Toy Fich faf@cam.ac.uk dot@dotat.at Uiversity of Cambridge Computig Service February 009 Abstract I these otes I eplai how to derive formulae for umerically
More informationA probabilistic proof of a binomial identity
A probabilistic proof of a biomial idetity Joatho Peterso Abstract We give a elemetary probabilistic proof of a biomial idetity. The proof is obtaied by computig the probability of a certai evet i two
More informationFactoring x n 1: cyclotomic and Aurifeuillian polynomials Paul Garrett <garrett@math.umn.edu>
(March 16, 004) Factorig x 1: cyclotomic ad Aurifeuillia polyomials Paul Garrett Polyomials of the form x 1, x 3 1, x 4 1 have at least oe systematic factorizatio x 1 = (x 1)(x 1
More information3. Greatest Common Divisor - Least Common Multiple
3 Greatest Commo Divisor - Least Commo Multiple Defiitio 31: The greatest commo divisor of two atural umbers a ad b is the largest atural umber c which divides both a ad b We deote the greatest commo gcd
More informationBasic Elements of Arithmetic Sequences and Series
MA40S PRE-CALCULUS UNIT G GEOMETRIC SEQUENCES CLASS NOTES (COMPLETED NO NEED TO COPY NOTES FROM OVERHEAD) Basic Elemets of Arithmetic Sequeces ad Series Objective: To establish basic elemets of arithmetic
More informationDetermining the sample size
Determiig the sample size Oe of the most commo questios ay statisticia gets asked is How large a sample size do I eed? Researchers are ofte surprised to fid out that the aswer depeds o a umber of factors
More informationA Secure Implementation of Java Inner Classes
A Secure Implemetatio of Java Ier Classes By Aasua Bhowmik ad William Pugh Departmet of Computer Sciece Uiversity of Marylad More ifo at: http://www.cs.umd.edu/~pugh/java Motivatio ad Overview Preset implemetatio
More informationNotes on exponential generating functions and structures.
Notes o expoetial geeratig fuctios ad structures. 1. The cocept of a structure. Cosider the followig coutig problems: (1) to fid for each the umber of partitios of a -elemet set, (2) to fid for each the
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies ( 3.1.1) Limitations of Experiments. Pseudocode ( 3.1.2) Theoretical Analysis
Ruig Time ( 3.) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationProject Deliverables. CS 361, Lecture 28. Outline. Project Deliverables. Administrative. Project Comments
Project Deliverables CS 361, Lecture 28 Jared Saia Uiversity of New Mexico Each Group should tur i oe group project cosistig of: About 6-12 pages of text (ca be loger with appedix) 6-12 figures (please
More informationSolutions to Exercises Chapter 4: Recurrence relations and generating functions
Solutios to Exercises Chapter 4: Recurrece relatios ad geeratig fuctios 1 (a) There are seatig positios arraged i a lie. Prove that the umber of ways of choosig a subset of these positios, with o two chose
More informationCHAPTER 3 THE TIME VALUE OF MONEY
CHAPTER 3 THE TIME VALUE OF MONEY OVERVIEW A dollar i the had today is worth more tha a dollar to be received i the future because, if you had it ow, you could ivest that dollar ad ear iterest. Of all
More informationMathematical goals. Starting points. Materials required. Time needed
Level A1 of challege: C A1 Mathematical goals Startig poits Materials required Time eeded Iterpretig algebraic expressios To help learers to: traslate betwee words, symbols, tables, ad area represetatios
More informationTHE REGRESSION MODEL IN MATRIX FORM. For simple linear regression, meaning one predictor, the model is. for i = 1, 2, 3,, n
We will cosider the liear regressio model i matrix form. For simple liear regressio, meaig oe predictor, the model is i = + x i + ε i for i =,,,, This model icludes the assumptio that the ε i s are a sample
More informationLesson 15 ANOVA (analysis of variance)
Outlie Variability -betwee group variability -withi group variability -total variability -F-ratio Computatio -sums of squares (betwee/withi/total -degrees of freedom (betwee/withi/total -mea square (betwee/withi
More information.04. This means $1000 is multiplied by 1.02 five times, once for each of the remaining sixmonth
Questio 1: What is a ordiary auity? Let s look at a ordiary auity that is certai ad simple. By this, we mea a auity over a fixed term whose paymet period matches the iterest coversio period. Additioally,
More informationBuilding Blocks Problem Related to Harmonic Series
TMME, vol3, o, p.76 Buildig Blocks Problem Related to Harmoic Series Yutaka Nishiyama Osaka Uiversity of Ecoomics, Japa Abstract: I this discussio I give a eplaatio of the divergece ad covergece of ifiite
More informationTime Value of Money. First some technical stuff. HP10B II users
Time Value of Moey Basis for the course Power of compoud iterest $3,600 each year ito a 401(k) pla yields $2,390,000 i 40 years First some techical stuff You will use your fiacial calculator i every sigle
More informationPermutations, the Parity Theorem, and Determinants
1 Permutatios, the Parity Theorem, ad Determiats Joh A. Guber Departmet of Electrical ad Computer Egieerig Uiversity of Wiscosi Madiso Cotets 1 What is a Permutatio 1 2 Cycles 2 2.1 Traspositios 4 3 Orbits
More informationLecture 13. Lecturer: Jonathan Kelner Scribe: Jonathan Pines (2009)
18.409 A Algorithmist s Toolkit October 27, 2009 Lecture 13 Lecturer: Joatha Keler Scribe: Joatha Pies (2009) 1 Outlie Last time, we proved the Bru-Mikowski iequality for boxes. Today we ll go over the
More informationSAMPLE QUESTIONS FOR FINAL EXAM. (1) (2) (3) (4) Find the following using the definition of the Riemann integral: (2x + 1)dx
SAMPLE QUESTIONS FOR FINAL EXAM REAL ANALYSIS I FALL 006 3 4 Fid the followig usig the defiitio of the Riema itegral: a 0 x + dx 3 Cosider the partitio P x 0 3, x 3 +, x 3 +,......, x 3 3 + 3 of the iterval
More informationPresent Value Factor To bring one dollar in the future back to present, one uses the Present Value Factor (PVF): Concept 9: Present Value
Cocept 9: Preset Value Is the value of a dollar received today the same as received a year from today? A dollar today is worth more tha a dollar tomorrow because of iflatio, opportuity cost, ad risk Brigig
More informationListing terms of a finite sequence List all of the terms of each finite sequence. a) a n n 2 for 1 n 5 1 b) a n for 1 n 4 n 2
74 (4 ) Chapter 4 Sequeces ad Series 4. SEQUENCES I this sectio Defiitio Fidig a Formula for the th Term The word sequece is a familiar word. We may speak of a sequece of evets or say that somethig is
More information*The most important feature of MRP as compared with ordinary inventory control analysis is its time phasing feature.
Itegrated Productio ad Ivetory Cotrol System MRP ad MRP II Framework of Maufacturig System Ivetory cotrol, productio schedulig, capacity plaig ad fiacial ad busiess decisios i a productio system are iterrelated.
More informationAsymptotic Growth of Functions
CMPS Itroductio to Aalysis of Algorithms Fall 3 Asymptotic Growth of Fuctios We itroduce several types of asymptotic otatio which are used to compare the performace ad efficiecy of algorithms As we ll
More informationMath C067 Sampling Distributions
Math C067 Samplig Distributios Sample Mea ad Sample Proportio Richard Beigel Some time betwee April 16, 2007 ad April 16, 2007 Examples of Samplig A pollster may try to estimate the proportio of voters
More informationChapter 5: Inner Product Spaces
Chapter 5: Ier Product Spaces Chapter 5: Ier Product Spaces SECION A Itroductio to Ier Product Spaces By the ed of this sectio you will be able to uderstad what is meat by a ier product space give examples
More informationS. Tanny MAT 344 Spring 1999. be the minimum number of moves required.
S. Tay MAT 344 Sprig 999 Recurrece Relatios Tower of Haoi Let T be the miimum umber of moves required. T 0 = 0, T = 7 Iitial Coditios * T = T + $ T is a sequece (f. o itegers). Solve for T? * is a recurrece,
More informationChatpun Khamyat Department of Industrial Engineering, Kasetsart University, Bangkok, Thailand ocpky@hotmail.com
SOLVING THE OIL DELIVERY TRUCKS ROUTING PROBLEM WITH MODIFY MULTI-TRAVELING SALESMAN PROBLEM APPROACH CASE STUDY: THE SME'S OIL LOGISTIC COMPANY IN BANGKOK THAILAND Chatpu Khamyat Departmet of Idustrial
More informationSection 8.3 : De Moivre s Theorem and Applications
The Sectio 8 : De Moivre s Theorem ad Applicatios Let z 1 ad z be complex umbers, where z 1 = r 1, z = r, arg(z 1 ) = θ 1, arg(z ) = θ z 1 = r 1 (cos θ 1 + i si θ 1 ) z = r (cos θ + i si θ ) ad z 1 z =
More information7.1 Finding Rational Solutions of Polynomial Equations
4 Locker LESSON 7. Fidig Ratioal Solutios of Polyomial Equatios Name Class Date 7. Fidig Ratioal Solutios of Polyomial Equatios Essetial Questio: How do you fid the ratioal roots of a polyomial equatio?
More informationElementary Theory of Russian Roulette
Elemetary Theory of Russia Roulette -iterestig patters of fractios- Satoshi Hashiba Daisuke Miematsu Ryohei Miyadera Itroductio. Today we are goig to study mathematical theory of Russia roulette. If some
More informationThe Power of Free Branching in a General Model of Backtracking and Dynamic Programming Algorithms
The Power of Free Brachig i a Geeral Model of Backtrackig ad Dyamic Programmig Algorithms SASHKA DAVIS IDA/Ceter for Computig Scieces Bowie, MD sashka.davis@gmail.com RUSSELL IMPAGLIAZZO Dept. of Computer
More informationFIBONACCI NUMBERS: AN APPLICATION OF LINEAR ALGEBRA. 1. Powers of a matrix
FIBONACCI NUMBERS: AN APPLICATION OF LINEAR ALGEBRA. Powers of a matrix We begi with a propositio which illustrates the usefuless of the diagoalizatio. Recall that a square matrix A is diogaalizable if
More informationChapter 14 Nonparametric Statistics
Chapter 14 Noparametric Statistics A.K.A. distributio-free statistics! Does ot deped o the populatio fittig ay particular type of distributio (e.g, ormal). Sice these methods make fewer assumptios, they
More informationThe new assembly line of the Car Corp.
MaMaEuSch Maagemet Mathematics for Europea Schools http://www.mathematik.uikl.de/~mamaeusch/ The ew assembly lie of the Car Corp. Silvia Schwarze Horst W. Hamacher 2 MaMaEuSch has bee carried out with
More informationConvexity, Inequalities, and Norms
Covexity, Iequalities, ad Norms Covex Fuctios You are probably familiar with the otio of cocavity of fuctios. Give a twicedifferetiable fuctio ϕ: R R, We say that ϕ is covex (or cocave up) if ϕ (x) 0 for
More information2-3 The Remainder and Factor Theorems
- The Remaider ad Factor Theorems Factor each polyomial completely usig the give factor ad log divisio 1 x + x x 60; x + So, x + x x 60 = (x + )(x x 15) Factorig the quadratic expressio yields x + x x
More informationLesson 17 Pearson s Correlation Coefficient
Outlie Measures of Relatioships Pearso s Correlatio Coefficiet (r) -types of data -scatter plots -measure of directio -measure of stregth Computatio -covariatio of X ad Y -uique variatio i X ad Y -measurig
More informationQuantitative Computer Architecture
Performace Measuremet ad Aalysis i Computer Quatitative Computer Measuremet Model Iovatio Proposed How to measure, aalyze, ad specify computer system performace or My computer is faster tha your computer!
More informationFM4 CREDIT AND BORROWING
FM4 CREDIT AND BORROWING Whe you purchase big ticket items such as cars, boats, televisios ad the like, retailers ad fiacial istitutios have various terms ad coditios that are implemeted for the cosumer
More informationProperties of MLE: consistency, asymptotic normality. Fisher information.
Lecture 3 Properties of MLE: cosistecy, asymptotic ormality. Fisher iformatio. I this sectio we will try to uderstad why MLEs are good. Let us recall two facts from probability that we be used ofte throughout
More informationSequences and Series Using the TI-89 Calculator
RIT Calculator Site Sequeces ad Series Usig the TI-89 Calculator Norecursively Defied Sequeces A orecursively defied sequece is oe i which the formula for the terms of the sequece is give explicitly. For
More informationMultiplexers and Demultiplexers
I this lesso, you will lear about: Multiplexers ad Demultiplexers 1. Multiplexers 2. Combiatioal circuit implemetatio with multiplexers 3. Demultiplexers 4. Some examples Multiplexer A Multiplexer (see
More informationhp calculators HP 12C Statistics - average and standard deviation Average and standard deviation concepts HP12C average and standard deviation
HP 1C Statistics - average ad stadard deviatio Average ad stadard deviatio cocepts HP1C average ad stadard deviatio Practice calculatig averages ad stadard deviatios with oe or two variables HP 1C Statistics
More informationMath 114- Intermediate Algebra Integral Exponents & Fractional Exponents (10 )
Math 4 Math 4- Itermediate Algebra Itegral Epoets & Fractioal Epoets (0 ) Epoetial Fuctios Epoetial Fuctios ad Graphs I. Epoetial Fuctios The fuctio f ( ) a, where is a real umber, a 0, ad a, is called
More informationWeek 3 Conditional probabilities, Bayes formula, WEEK 3 page 1 Expected value of a random variable
Week 3 Coditioal probabilities, Bayes formula, WEEK 3 page 1 Expected value of a radom variable We recall our discussio of 5 card poker hads. Example 13 : a) What is the probability of evet A that a 5
More information1. C. The formula for the confidence interval for a population mean is: x t, which was
s 1. C. The formula for the cofidece iterval for a populatio mea is: x t, which was based o the sample Mea. So, x is guarateed to be i the iterval you form.. D. Use the rule : p-value
More informationHow to set up your GMC Online account
How to set up your GMC Olie accout Mai title Itroductio GMC Olie is a secure part of our website that allows you to maage your registratio with us. Over 100,000 doctors already use GMC Olie. We wat every
More informationWHEN IS THE (CO)SINE OF A RATIONAL ANGLE EQUAL TO A RATIONAL NUMBER?
WHEN IS THE (CO)SINE OF A RATIONAL ANGLE EQUAL TO A RATIONAL NUMBER? JÖRG JAHNEL 1. My Motivatio Some Sort of a Itroductio Last term I tought Topological Groups at the Göttige Georg August Uiversity. This
More informationNotes on Combinatorics. Peter J. Cameron
Notes o Combiatorics Peter J Camero ii Preface: What is Combiatorics? Combiatorics, the mathematics of patters,, helps us desig computer etwors, crac security codes, or solve sudous Ursula Marti, Vice-Pricipal
More informationStatic revisited. Odds and ends. Static methods. Static methods 5/2/16. Some features of Java we haven t discussed
Odds ad eds Static revisited Some features of Java we have t discussed Static methods // Example: // Java's built i Math class public class Math { public static it abs(it a) { if (a >= 0) { retur a; else
More informationFactors of sums of powers of binomial coefficients
ACTA ARITHMETICA LXXXVI.1 (1998) Factors of sums of powers of biomial coefficiets by Neil J. Cali (Clemso, S.C.) Dedicated to the memory of Paul Erdős 1. Itroductio. It is well ow that if ( ) a f,a = the
More informationReview: Classification Outline
Data Miig CS 341, Sprig 2007 Decisio Trees Neural etworks Review: Lecture 6: Classificatio issues, regressio, bayesia classificatio Pretice Hall 2 Data Miig Core Techiques Classificatio Clusterig Associatio
More informationCooley-Tukey. Tukey FFT Algorithms. FFT Algorithms. Cooley
Cooley Cooley-Tuey Tuey FFT Algorithms FFT Algorithms Cosider a legth- sequece x[ with a -poit DFT X[ where Represet the idices ad as +, +, Cooley Cooley-Tuey Tuey FFT Algorithms FFT Algorithms Usig these
More informationCHAPTER 11 Financial mathematics
CHAPTER 11 Fiacial mathematics I this chapter you will: Calculate iterest usig the simple iterest formula ( ) Use the simple iterest formula to calculate the pricipal (P) Use the simple iterest formula
More informationSimple Annuities Present Value.
Simple Auities Preset Value. OBJECTIVES (i) To uderstad the uderlyig priciple of a preset value auity. (ii) To use a CASIO CFX-9850GB PLUS to efficietly compute values associated with preset value auities.
More informationConcept: Types of algorithms
Discrete Math for Bioiformatics WS 10/11:, by A. Bockmayr/K. Reiert, 18. Oktober 2010, 21:22 1001 Cocept: Types of algorithms The expositio is based o the followig sources, which are all required readig:
More informationDesktop Management. Desktop Management Tools
Desktop Maagemet 9 Desktop Maagemet Tools Mac OS X icludes three desktop maagemet tools that you might fid helpful to work more efficietly ad productively: u Stacks puts expadable folders i the Dock. Clickig
More informationSEQUENCES AND SERIES
Chapter 9 SEQUENCES AND SERIES Natural umbers are the product of huma spirit. DEDEKIND 9.1 Itroductio I mathematics, the word, sequece is used i much the same way as it is i ordiary Eglish. Whe we say
More informationLecture 3. denote the orthogonal complement of S k. Then. 1 x S k. n. 2 x T Ax = ( ) λ x. with x = 1, we have. i = λ k x 2 = λ k.
18.409 A Algorithmist s Toolkit September 17, 009 Lecture 3 Lecturer: Joatha Keler Scribe: Adre Wibisoo 1 Outlie Today s lecture covers three mai parts: Courat-Fischer formula ad Rayleigh quotiets The
More informationThe Stable Marriage Problem
The Stable Marriage Problem William Hut Lae Departmet of Computer Sciece ad Electrical Egieerig, West Virgiia Uiversity, Morgatow, WV William.Hut@mail.wvu.edu 1 Itroductio Imagie you are a matchmaker,
More informationCME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 8
CME 30: NUMERICAL LINEAR ALGEBRA FALL 005/06 LECTURE 8 GENE H GOLUB 1 Positive Defiite Matrices A matrix A is positive defiite if x Ax > 0 for all ozero x A positive defiite matrix has real ad positive
More informationI. Why is there a time value to money (TVM)?
Itroductio to the Time Value of Moey Lecture Outlie I. Why is there the cocept of time value? II. Sigle cash flows over multiple periods III. Groups of cash flows IV. Warigs o doig time value calculatios
More informationAgenda. Outsourcing and Globalization in Software Development. Outsourcing. Outsourcing here to stay. Outsourcing Alternatives
Outsourcig ad Globalizatio i Software Developmet Jacques Crocker UW CSE Alumi 2003 jc@cs.washigto.edu Ageda Itroductio The Outsourcig Pheomeo Leadig Offshore Projects Maagig Customers Offshore Developmet
More informationDefinition. A variable X that takes on values X 1, X 2, X 3,...X k with respective frequencies f 1, f 2, f 3,...f k has mean
1 Social Studies 201 October 13, 2004 Note: The examples i these otes may be differet tha used i class. However, the examples are similar ad the methods used are idetical to what was preseted i class.
More informationFast Fourier Transform
18.310 lecture otes November 18, 2013 Fast Fourier Trasform Lecturer: Michel Goemas I these otes we defie the Discrete Fourier Trasform, ad give a method for computig it fast: the Fast Fourier Trasform.
More informationDomain 1: Designing a SQL Server Instance and a Database Solution
Maual SQL Server 2008 Desig, Optimize ad Maitai (70-450) 1-800-418-6789 Domai 1: Desigig a SQL Server Istace ad a Database Solutio Desigig for CPU, Memory ad Storage Capacity Requiremets Whe desigig a
More information0.7 0.6 0.2 0 0 96 96.5 97 97.5 98 98.5 99 99.5 100 100.5 96.5 97 97.5 98 98.5 99 99.5 100 100.5
Sectio 13 Kolmogorov-Smirov test. Suppose that we have a i.i.d. sample X 1,..., X with some ukow distributio P ad we would like to test the hypothesis that P is equal to a particular distributio P 0, i.e.
More informationHypergeometric Distributions
7.4 Hypergeometric Distributios Whe choosig the startig lie-up for a game, a coach obviously has to choose a differet player for each positio. Similarly, whe a uio elects delegates for a covetio or you
More information1 Computing the Standard Deviation of Sample Means
Computig the Stadard Deviatio of Sample Meas Quality cotrol charts are based o sample meas ot o idividual values withi a sample. A sample is a group of items, which are cosidered all together for our aalysis.
More informationCHAPTER 7: Central Limit Theorem: CLT for Averages (Means)
CHAPTER 7: Cetral Limit Theorem: CLT for Averages (Meas) X = the umber obtaied whe rollig oe six sided die oce. If we roll a six sided die oce, the mea of the probability distributio is X P(X = x) Simulatio:
More informationChapter 7: Confidence Interval and Sample Size
Chapter 7: Cofidece Iterval ad Sample Size Learig Objectives Upo successful completio of Chapter 7, you will be able to: Fid the cofidece iterval for the mea, proportio, ad variace. Determie the miimum
More informationOutput Analysis (2, Chapters 10 &11 Law)
B. Maddah ENMG 6 Simulatio 05/0/07 Output Aalysis (, Chapters 10 &11 Law) Comparig alterative system cofiguratio Sice the output of a simulatio is radom, the comparig differet systems via simulatio should
More informationSection 11.3: The Integral Test
Sectio.3: The Itegral Test Most of the series we have looked at have either diverged or have coverged ad we have bee able to fid what they coverge to. I geeral however, the problem is much more difficult
More information5.4 Amortization. Question 1: How do you find the present value of an annuity? Question 2: How is a loan amortized?
5.4 Amortizatio Questio 1: How do you fid the preset value of a auity? Questio 2: How is a loa amortized? Questio 3: How do you make a amortizatio table? Oe of the most commo fiacial istrumets a perso
More informationCS100: Introduction to Computer Science
Review: History of Computers CS100: Itroductio to Computer Sciece Maiframes Miicomputers Lecture 2: Data Storage -- Bits, their storage ad mai memory Persoal Computers & Workstatios Review: The Role of
More informationLaws of Exponents Learning Strategies
Laws of Epoets Learig Strategies What should studets be able to do withi this iteractive? Studets should be able to uderstad ad use of the laws of epoets. Studets should be able to simplify epressios that
More informationMath 113 HW #11 Solutions
Math 3 HW # Solutios 5. 4. (a) Estimate the area uder the graph of f(x) = x from x = to x = 4 usig four approximatig rectagles ad right edpoits. Sketch the graph ad the rectagles. Is your estimate a uderestimate
More information