Introduction to Algorithms

Size: px
Start display at page:

Download "Introduction to Algorithms"

Transcription

1 Itroductio to Algorithms 6.046J/8.40J LECTURE 9 Radomly built biary search trees Epected ode depth Aalyzig height Coveity lemma Jese s iequality Epoetial height Post mortem Pro. Eri Demaie October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.

2 Biary-search-tree sort T Create a empty BST or i to do TREE-INSERT(T, A[i] Perorm a iorder tree wal o T. Eample: A [ ] Tree-wal time O(, but how log does it tae to build the BST? October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.2

3 Aalysis o BST sort BST sort perorms the same comparisos as quicsort, but i a dieret order! The epected time to build the tree is asymptotically the same as the ruig time o quicsort. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.3

4 Node depth The depth o a ode the umber o comparisos made durig TREE-INSERT. Assumig all iput permutatios are equally liely, we have Average ode depth E # comparisos i O( lg O(lg. to isert ode ( (quicsort aalysis October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.4 i

5 Epected tree height But, average ode depth o a radomly built BST O(lg does ot ecessarily mea that its epected height is also O(lg (although it is. Eample. lg Ave. depth lg + O(lg 2 h October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.5

6 Height o a radomly built biary search tree Outlie o the aalysis: Prove Jese s iequality, which says that (E[X] E[(X] or ay cove uctio ad radom variable X. Aalyze the epoetial height o a radomly built BST o odes, which is the radom variable 2 X, where X is the radom variable deotig the height o the BST. Prove that 2 E[X ] E[2 X ] E[ ] O( 3, ad hece that E[X ] O(lg. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.6

7 Cove uctios A uctio : R R is cove i or all,β 0 such that + β, we have ( + βy ( + β (y or all,y R. ( + β(y (y ( ( + βy + βy y October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.7

8 Coveity lemma Lemma. Let : R R be a cove uctio, ad let, 2,, be oegative real umbers such that. The, or ay real umbers, 2,,, we have (. Proo. By iductio o. For, we have, ad hece ( ( trivially. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.8

9 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.9 Proo (cotiued Iductive step: + ( Algebra.

10 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.0 Proo (cotiued Iductive step: + + ( ( ( Coveity.

11 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7. Proo (cotiued Iductive step: ( ( ( ( ( ( Iductio.

12 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.2 Proo (cotiued Iductive step: ( ( ( ( ( ( ( Algebra..

13 Coveity lemma: iiite case Lemma. Let : R R be a cove uctio, ad let, 2,, be oegative real umbers such that. The, or ay real umbers, 2,, we have (, assumig that these summatios eist. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.3

14 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.4 Coveity lemma: iiite case Proo. By the coveity lemma, or ay, ( i i i i.

15 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.5 Coveity lemma: iiite case Proo. By the coveity lemma, or ay, ( i i i i. Taig the limit o both sides (ad because the iequality is ot strict: ( lim lim i i i i (

16 Jese s iequality Lemma. Let be a cove uctio, ad let X be a radom variable. The, (E[X] E[ (X]. Proo. ( E[ X ] Pr{ X } Deiitio o epectatio. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.6

17 Jese s iequality Lemma. Let be a cove uctio, ad let X be a radom variable. The, (E[X] E[ (X]. Proo. ( E[ X ] Pr{ X } ( Pr{ X } Coveity lemma (iiite case. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.7

18 Jese s iequality Lemma. Let be a cove uctio, ad let X be a radom variable. The, (E[X] E[ (X]. Proo. ( E[ X ] Pr{ X } ( Pr{ X } E[ ( X ]. Tricy step, but true thi about it. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.8

19 Aalysis o BST height Let X be the radom variable deotig the height o a radomly built biary search tree o odes, ad let 2 X be its epoetial height. I the root o the tree has ra, the X + ma{x,x }, sice each o the let ad right subtrees o the root are radomly built. Hece, we have 2 ma{, }. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.9

20 Aalysis (cotiued Deie the idicator radom variable Z as Z i the root has ra, 0 otherwise. Thus, Pr{Z } E[Z ] /, ad Z 2 ma{., } ( October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.20

21 Epoetial height recurrece [ ] E Z ( 2 ma{, E } Tae epectatio o both sides. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.2

22 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.22 Epoetial height recurrece [ ] ( ( [ ] Z E Z E E }, ma{ 2 }, ma{ 2 Liearity o epectatio.

23 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.23 Epoetial height recurrece [ ] ( ( [ ] E Z E Z E Z E E }], [ma{ ] [ 2 }, ma{ 2 }, ma{ 2 Idepedece o the ra o the root rom the ras o subtree roots.

24 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.24 Epoetial height recurrece [ ] ( ( [ ] + E E Z E Z E Z E E ] [ 2 }], [ma{ ] [ 2 }, ma{ 2 }, ma{ 2 The ma o two oegative umbers is at most their sum, ad E[Z ] /.

25 October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.25 Epoetial height recurrece [ ] ( ( [ ] + 0 ] [ 4 ] [ 2 }], [ma{ ] [ 2 }, ma{ 2 }, ma{ 2 E E E Z E Z E Z E E Each term appears twice, ad reide.

26 Solvig the recurrece Use substitutio to show that E[ ] c 3 or some positive costat c, which we ca pic suicietly large to hadle the iitial coditios. 4 E[ 0 [ ] E ] October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.26

27 Solvig the recurrece Use substitutio to show that E[ ] c 3 or some positive costat c, which we ca pic suicietly large to hadle the iitial coditios. [ ] E E[ c 3 Substitutio. ] October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.27

28 Solvig the recurrece Use substitutio to show that E[ ] c 3 or some positive costat c, which we ca pic suicietly large to hadle the iitial coditios. [ ] E 4 4 4c E[ c 3 3 d ] Itegral method. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.28

29 Solvig the recurrece Use substitutio to show that E[ ] c 3 or some positive costat c, which we ca pic suicietly large to hadle the iitial coditios. [ ] E 4 4 4c 4c E[ c d Solve the itegral. ] October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.29

30 Solvig the recurrece Use substitutio to show that E[ ] c 3 or some positive costat c, which we ca pic suicietly large to hadle the iitial coditios. [ ] E 4 4 4c 4c c E[ c d ] 4. Algebra. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.30

31 The grad iale Puttig it all together, we have 2 E[X ] E[2 X ] Jese s iequality, sice ( 2 is cove. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.3

32 The grad iale Puttig it all together, we have 2 E[X] E[2 X ] E[ ] Deiitio. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.32

33 The grad iale Puttig it all together, we have 2 E[X] E[2 X ] E[ ] c 3. What we just showed. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.33

34 The grad iale Puttig it all together, we have 2 E[X] E[2 X ] E[ ] c 3. Taig the lg o both sides yields E[X ] 3lg +O(. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.34

35 Post mortem Q. Does the aalysis have to be this hard? Q. Why bother with aalyzig epoetial height? Q. Why ot just develop the recurrece o directly? X + ma{x,x } October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.35

36 Post mortem (cotiued A. The iequality ma{a, b} a + b. provides a poor upper boud, sice the RHS approaches the LHS slowly as a b icreases. The boud ma{2 a,2 b } 2 a + 2 b allows the RHS to approach the LHS ar more quicly as a b icreases. By usig the coveity o ( 2 via Jese s iequality, we ca maipulate the sum o epoetials, resultig i a tight aalysis. October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.36

37 Thought eercises See what happes whe you try to do the aalysis o X directly. Try to uderstad better why the proo uses a epoetial. Will a quadratic do? See i you ca id a simpler argumet. (This argumet is a little simpler tha the oe i the boo I hope it s correct! October 7, 2005 Copyright by Eri D. Demaie ad Charles E. Leiserso L7.37

Introduction to Algorithms

Introduction to Algorithms Itroductio to Algorithms 6.046J/8.40J/SMA5503 Lecture 9 Pro. Charles E. Leiserso Biary-search-tree sort T Create a empty BST or i to do TREE-INSERT(T, A[i]) Perorm a iorder tree wal o T. Eample: A [3 8

More information

Relation of BSTs to Quicksort, Analysis of Random BST. Lecture 9

Relation of BSTs to Quicksort, Analysis of Random BST. Lecture 9 Reltio o BSTs to Quicsort, Alysis o Rdom BST Lecture 9 Biry-serch-tree sort T Crete empty BST or i = to do TREE-INSERT(T, A[i]) Perorm iorder tree wl o T. Emple: 3 A = [3 8 2 6 7 5] 8 Tree-wl time = O(),

More information

CS583 Lecture 02. Jana Kosecka. some materials here are based on E. Demaine, D. Luebke slides

CS583 Lecture 02. Jana Kosecka. some materials here are based on E. Demaine, D. Luebke slides CS583 Lecture 02 Jaa Kosecka some materials here are based o E. Demaie, D. Luebke slides Previously Sample algorithms Exact ruig time, pseudo-code Approximate ruig time Worst case aalysis Best case aalysis

More information

Data Structures and Algorithm. Xiaoqing Zheng

Data Structures and Algorithm. Xiaoqing Zheng Data Structures ad Algorithm Xiaoqig Zheg zhegxq@fudaeduc What are algorithms? A sequece of computatioal steps that trasform the iput ito the output Sortig problem: Iput: A sequece of umbers

More information

CS / MCS 401 Homework 3 grader solutions

CS / MCS 401 Homework 3 grader solutions CS / MCS 401 Homework 3 grader solutios assigmet due July 6, 016 writte by Jāis Lazovskis maximum poits: 33 Some questios from CLRS. Questios marked with a asterisk were ot graded. 1 Use the defiitio of

More information

Algorithms and Data Structures Lecture IV

Algorithms and Data Structures Lecture IV Algorithms ad Data Structures Lecture IV Simoas Šalteis Aalborg Uiversity simas@cs.auc.dk September 5, 00 1 This Lecture Aalyzig the ruig time of recursive algorithms (such as divide-ad-coquer) Writig

More information

CS 332: Algorithms. Quicksort

CS 332: Algorithms. Quicksort CS 33: Aorithms Quicsort David Luebe //03 Homewor Assiged today, due ext Wedesday Will be o web page shortly after class Go over ow David Luebe //03 Review: Quicsort Sorts i place Sorts O( ) i the average

More information

This Lecture. Divide and Conquer. Merge Sort: Algorithm. Merge Sort Algorithm. MergeSort (Example) - 1. MergeSort (Example) - 2

This Lecture. Divide and Conquer. Merge Sort: Algorithm. Merge Sort Algorithm. MergeSort (Example) - 1. MergeSort (Example) - 2 This Lecture Divide-ad-coquer techique for algorithm desig. Example the merge sort. Writig ad solvig recurreces Divide ad Coquer Divide-ad-coquer method for algorithm desig: Divide: If the iput size is

More information

Test One (Answer Key)

Test One (Answer Key) CS395/Ma395 (Sprig 2005) Test Oe Name: Page 1 Test Oe (Aswer Key) CS395/Ma395: Aalysis of Algorithms This is a closed book, closed otes, 70 miute examiatio. It is worth 100 poits. There are twelve (12)

More information

CS 270 Algorithms. Oliver Kullmann. Growth of Functions. Divide-and- Conquer Min-Max- Problem. Tutorial. Reading from CLRS for week 2

CS 270 Algorithms. Oliver Kullmann. Growth of Functions. Divide-and- Conquer Min-Max- Problem. Tutorial. Reading from CLRS for week 2 Geeral remarks Week 2 1 Divide ad First we cosider a importat tool for the aalysis of algorithms: Big-Oh. The we itroduce a importat algorithmic paradigm:. We coclude by presetig ad aalysig two examples.

More information

CS 171 Lecture Outline October 09, 2008

CS 171 Lecture Outline October 09, 2008 CS 171 Lecture Outlie October 09, 2008 The followig theorem comes very hady whe calculatig the expectatio of a radom variable that takes o o-egative iteger values. Theorem: Let Y be a radom variable that

More information

Recursive Algorithms. Recurrences. Recursive Algorithms Analysis

Recursive Algorithms. Recurrences. Recursive Algorithms Analysis Recursive Algorithms Recurreces Computer Sciece & Egieerig 35: Discrete Mathematics Christopher M Bourke cbourke@cseuledu A recursive algorithm is oe i which objects are defied i terms of other objects

More information

Introduction to Algorithms 6.046J/18.401J LECTURE 3 Divide and conquer Binary search Powering a number Fibonacci numbers Matrix multiplication

Introduction to Algorithms 6.046J/18.401J LECTURE 3 Divide and conquer Binary search Powering a number Fibonacci numbers Matrix multiplication Itroductio to Algorithms 6.046J/8.40J LECTURE 3 Divide ad coquer Biary search Powerig a umber Fiboacci umbers Matrix multiplicatio Strasse s algorithm VLSI tree layout Prof. Charles E. Leiserso The divide-ad-coquer

More information

An Introduction to Randomized Algorithms

An Introduction to Randomized Algorithms A Itroductio to Radomized Algorithms The focus of this lecture is to study a radomized algorithm for quick sort, aalyze it usig probabilistic recurrece relatios, ad also provide more geeral tools for aalysis

More information

Lecture 2 February 8, 2016

Lecture 2 February 8, 2016 MIT 6.854/8.45: Advaced Algorithms Sprig 206 Prof. Akur Moitra Lecture 2 February 8, 206 Scribe: Calvi Huag, Lih V. Nguye I this lecture, we aalyze the problem of schedulig equal size tasks arrivig olie

More information

ECE 6980 An Algorithmic and Information-Theoretic Toolbox for Massive Data

ECE 6980 An Algorithmic and Information-Theoretic Toolbox for Massive Data ECE 6980 A Algorithmic ad Iformatio-Theoretic Toolbo for Massive Data Istructor: Jayadev Acharya Lecture # Scribe: Huayu Zhag 8th August, 017 1 Recap X =, ε is a accuracy parameter, ad δ is a error parameter.

More information

Analysis of Algorithms -Quicksort-

Analysis of Algorithms -Quicksort- Aalysis of Algorithms -- Adreas Ermedahl MRTC (Mälardales Real-Time Research Ceter) adreas.ermedahl@mdh.se Autum 2004 Proposed by C.A.R. Hoare i 962 Worst- case ruig time: Θ( 2 ) Expected ruig time: Θ(

More information

CS161: Algorithm Design and Analysis Handout #10 Stanford University Wednesday, 10 February 2016

CS161: Algorithm Design and Analysis Handout #10 Stanford University Wednesday, 10 February 2016 CS161: Algorithm Desig ad Aalysis Hadout #10 Staford Uiversity Wedesday, 10 February 2016 Lecture #11: Wedesday, 10 February 2016 Topics: Example midterm problems ad solutios from a log time ago Sprig

More information

Analysis of Algorithms. Introduction. Contents

Analysis of Algorithms. Introduction. Contents Itroductio The focus of this module is mathematical aspects of algorithms. Our mai focus is aalysis of algorithms, which meas evaluatig efficiecy of algorithms by aalytical ad mathematical methods. We

More information

A recurrence equation is just a recursive function definition. It defines a function at one input in terms of its value on smaller inputs.

A recurrence equation is just a recursive function definition. It defines a function at one input in terms of its value on smaller inputs. CS23 Algorithms Hadout #6 Prof Ly Turbak September 8, 200 Wellesley College RECURRENCES This hadout summarizes highlights of CLRS Chapter 4 ad Appedix A (CLR Chapters 3 & 4) Two-Step Strategy for Aalyzig

More information

CIS 121 Data Structures and Algorithms with Java Spring Code Snippets and Recurrences Monday, February 4/Tuesday, February 5

CIS 121 Data Structures and Algorithms with Java Spring Code Snippets and Recurrences Monday, February 4/Tuesday, February 5 CIS 11 Data Structures ad Algorithms with Java Sprig 019 Code Sippets ad Recurreces Moday, February 4/Tuesday, February 5 Learig Goals Practice provig asymptotic bouds with code sippets Practice solvig

More information

Lecture 01: the Central Limit Theorem. 1 Central Limit Theorem for i.i.d. random variables

Lecture 01: the Central Limit Theorem. 1 Central Limit Theorem for i.i.d. random variables CSCI-B609: A Theorist s Toolkit, Fall 06 Aug 3 Lecture 0: the Cetral Limit Theorem Lecturer: Yua Zhou Scribe: Yua Xie & Yua Zhou Cetral Limit Theorem for iid radom variables Let us say that we wat to aalyze

More information

Maclaurin and Taylor series

Maclaurin and Taylor series At the ed o the previous chapter we looed at power series ad oted that these were dieret rom other iiite series as they were actually uctios o a variable R: a a + + a + a a Maclauri ad Taylor series +

More information

These Two Weeks. Mathematical Induction Chapter 4 Lecture 10 & Lecture 13. CPRE 310 Discrete Mathematics. Mathematical Induction Problems

These Two Weeks. Mathematical Induction Chapter 4 Lecture 10 & Lecture 13. CPRE 310 Discrete Mathematics. Mathematical Induction Problems These Two Wees CPRE 0 Discrete Mathematics Mathematical Iductio Chapter Lecture 0 & Lecture Lecture 0 Mathematical Iductio (MI) MI Problems Lecture, Review Lecture February 9, Test I A list of topics ad

More information

LECTURE SERIES WITH NONNEGATIVE TERMS (II). SERIES WITH ARBITRARY TERMS

LECTURE SERIES WITH NONNEGATIVE TERMS (II). SERIES WITH ARBITRARY TERMS LECTURE 4 SERIES WITH NONNEGATIVE TERMS II). SERIES WITH ARBITRARY TERMS Series with oegative terms II) Theorem 4.1 Kummer s Test) Let x be a series with positive terms. 1 If c ) N i 0, + ), r > 0 ad 0

More information

Sums, products and sequences

Sums, products and sequences Sums, products ad sequeces How to write log sums, e.g., 1+2+ (-1)+ cocisely? i=1 Sum otatio ( sum from 1 to ): i 3 = 1 + 2 + + If =3, i=1 i = 1+2+3=6. The ame ii does ot matter. Could use aother letter

More information

ALG 2.2 Search Algorithms

ALG 2.2 Search Algorithms Algorithms Professor Joh Reif ALG 2.2 Search Algorithms (a Biary Search: average case (b Biary Search with Errors (homework (c Iterpolatio Search (d Ubouded Search Biary Search Trees (i sorted Table of

More information

Mathematical Foundation. CSE 6331 Algorithms Steve Lai

Mathematical Foundation. CSE 6331 Algorithms Steve Lai Mathematical Foudatio CSE 6331 Algorithms Steve Lai Complexity of Algorithms Aalysis of algorithm: to predict the ruig time required by a algorithm. Elemetary operatios: arithmetic & boolea operatios:

More information

6.046 Recitation 5: Binary Search Trees Bill Thies, Fall 2004 Outline

6.046 Recitation 5: Binary Search Trees Bill Thies, Fall 2004 Outline 6.046 Recitatio 5: Biary Search Trees Bill Thies, Fall 2004 Outlie My cotact iformatio: Bill Thies thies@mit.edu Office hours: Sat 1-3pm, 36-153 Recitatio website: http://cag.lcs.mit.edu/~thies/6.046/

More information

Differential Entropy

Differential Entropy School o Iormatio Sciece Dieretial Etropy 009 - Course - Iormatio Theory - Tetsuo Asao ad Tad matsumoto Email: {t-asao matumoto}@jaist.ac.jp Japa Advaced Istitute o Sciece ad Techology Asahidai - Nomi

More information

Context-free grammars and. Basics of string generation methods

Context-free grammars and. Basics of string generation methods Cotext-free grammars ad laguages Basics of strig geeratio methods What s so great about regular expressios? A regular expressio is a strig represetatio of a regular laguage This allows the storig a whole

More information

COMP26120: More on the Complexity of Recursive Programs (2018/19) Lucas Cordeiro

COMP26120: More on the Complexity of Recursive Programs (2018/19) Lucas Cordeiro COMP26120: More o the Complexity of Recursive Programs (2018/19) Lucas Cordeiro lucas.cordeiro@machester.ac.uk Divide-ad-Coquer (Recurrece) Textbook: Algorithm Desig ad Applicatios, Goodrich, Michael T.

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Desig ad Aalysis of Algorithms Probabilistic aalysis ad Radomized algorithms Referece: CLRS Chapter 5 Topics: Hirig problem Idicatio radom variables Radomized algorithms Huo Hogwei 1 The hirig problem

More information

Recurrence Relations

Recurrence Relations Recurrece Relatios Aalysis of recursive algorithms, such as: it factorial (it ) { if (==0) retur ; else retur ( * factorial(-)); } Let t be the umber of multiplicatios eeded to calculate factorial(). The

More information

Modern Algebra 1 Section 1 Assignment 1. Solution: We have to show that if you knock down any one domino, then it knocks down the one behind it.

Modern Algebra 1 Section 1 Assignment 1. Solution: We have to show that if you knock down any one domino, then it knocks down the one behind it. Moder Algebra 1 Sectio 1 Assigmet 1 JOHN PERRY Eercise 1 (pg 11 Warm-up c) Suppose we have a ifiite row of domioes, set up o ed What sort of iductio argumet would covice us that ocig dow the first domio

More information

Topic 9 - Taylor and MacLaurin Series

Topic 9 - Taylor and MacLaurin Series Topic 9 - Taylor ad MacLauri Series A. Taylors Theorem. The use o power series is very commo i uctioal aalysis i act may useul ad commoly used uctios ca be writte as a power series ad this remarkable result

More information

Data Structures Lecture 9

Data Structures Lecture 9 Fall 2017 Fag Yu Software Security Lab. Dept. Maagemet Iformatio Systems, Natioal Chegchi Uiversity Data Structures Lecture 9 Midterm o Dec. 7 (9:10-12:00am, 106) Lec 1-9, TextBook Ch1-8, 11,12 How to

More information

Model of Computation and Runtime Analysis

Model of Computation and Runtime Analysis Model of Computatio ad Rutime Aalysis Model of Computatio Model of Computatio Specifies Set of operatios Cost of operatios (ot ecessarily time) Examples Turig Machie Radom Access Machie (RAM) PRAM Map

More information

Math 140A Elementary Analysis Homework Questions 1

Math 140A Elementary Analysis Homework Questions 1 Math 14A Elemetary Aalysis Homewor Questios 1 1 Itroductio 1.1 The Set N of Natural Numbers 1 Prove that 1 2 2 2 2 1 ( 1(2 1 for all atural umbers. 2 Prove that 3 11 (8 5 4 2 for all N. 4 (a Guess a formula

More information

Sequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018

Sequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018 CSE 353 Discrete Computatioal Structures Sprig 08 Sequeces, Mathematical Iductio, ad Recursio (Chapter 5, Epp) Note: some course slides adopted from publisher-provided material Overview May mathematical

More information

Model of Computation and Runtime Analysis

Model of Computation and Runtime Analysis Model of Computatio ad Rutime Aalysis Model of Computatio Model of Computatio Specifies Set of operatios Cost of operatios (ot ecessarily time) Examples Turig Machie Radom Access Machie (RAM) PRAM Map

More information

Homework 9. (n + 1)! = 1 1

Homework 9. (n + 1)! = 1 1 . Chapter : Questio 8 If N, the Homewor 9 Proof. We will prove this by usig iductio o. 2! + 2 3! + 3 4! + + +! +!. Base step: Whe the left had side is. Whe the right had side is 2! 2 +! 2 which proves

More information

CDS 101: Lecture 5.1 Controllability and State Space Feedback

CDS 101: Lecture 5.1 Controllability and State Space Feedback CDS, Lecture 5. CDS : Lecture 5. Cotrollability ad State Space Feedback Richard M. Murray 8 October Goals: Deie cotrollability o a cotrol system Give tests or cotrollability o liear systems ad apply to

More information

Read carefully the instructions on the answer book and make sure that the particulars required are entered on each answer book.

Read carefully the instructions on the answer book and make sure that the particulars required are entered on each answer book. THE UNIVERSITY OF WARWICK FIRST YEAR EXAMINATION: Jauary 2009 Aalysis I Time Allowed:.5 hours Read carefully the istructios o the aswer book ad make sure that the particulars required are etered o each

More information

Sorting Algorithms. Algorithms Kyuseok Shim SoEECS, SNU.

Sorting Algorithms. Algorithms Kyuseok Shim SoEECS, SNU. Sortig Algorithms Algorithms Kyuseo Shim SoEECS, SNU. Desigig Algorithms Icremetal approaches Divide-ad-Coquer approaches Dyamic programmig approaches Greedy approaches Radomized approaches You are ot

More information

Seunghee Ye Ma 8: Week 5 Oct 28

Seunghee Ye Ma 8: Week 5 Oct 28 Week 5 Summary I Sectio, we go over the Mea Value Theorem ad its applicatios. I Sectio 2, we will recap what we have covered so far this term. Topics Page Mea Value Theorem. Applicatios of the Mea Value

More information

Problem Set 2 Solutions

Problem Set 2 Solutions CS271 Radomess & Computatio, Sprig 2018 Problem Set 2 Solutios Poit totals are i the margi; the maximum total umber of poits was 52. 1. Probabilistic method for domiatig sets 6pts Pick a radom subset S

More information

CS321. Numerical Analysis and Computing

CS321. Numerical Analysis and Computing CS Numerical Aalysis ad Computig Lecture Locatig Roots o Equatios Proessor Ju Zhag Departmet o Computer Sciece Uiversity o Ketucky Leigto KY 456-6 September 8 5 What is the Root May physical system ca

More information

Algorithm Analysis. Chapter 3

Algorithm Analysis. Chapter 3 Data Structures Dr Ahmed Rafat Abas Computer Sciece Dept, Faculty of Computer ad Iformatio, Zagazig Uiversity arabas@zu.edu.eg http://www.arsaliem.faculty.zu.edu.eg/ Algorithm Aalysis Chapter 3 3. Itroductio

More information

ST5215: Advanced Statistical Theory

ST5215: Advanced Statistical Theory ST525: Advaced Statistical Theory Departmet of Statistics & Applied Probability Tuesday, September 7, 2 ST525: Advaced Statistical Theory Lecture : The law of large umbers The Law of Large Numbers The

More information

CS537. Numerical Analysis and Computing

CS537. Numerical Analysis and Computing CS57 Numerical Aalysis ad Computig Lecture Locatig Roots o Equatios Proessor Ju Zhag Departmet o Computer Sciece Uiversity o Ketucky Leigto KY 456-6 Jauary 9 9 What is the Root May physical system ca be

More information

A Probabilistic Analysis of Quicksort

A Probabilistic Analysis of Quicksort A Probabilistic Aalysis of Quicsort You are assumed to be familiar with Quicsort. I each iteratio this sortig algorithm chooses a pivot ad the, by performig comparisios with the pivot, splits the remaider

More information

Signals and Systems. Problem Set: From Continuous-Time to Discrete-Time

Signals and Systems. Problem Set: From Continuous-Time to Discrete-Time Sigals ad Systems Problem Set: From Cotiuous-Time to Discrete-Time Updated: October 5, 2017 Problem Set Problem 1 - Liearity ad Time-Ivariace Cosider the followig systems ad determie whether liearity ad

More information

CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN

CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN CSI 5163 (95.5703) ALGORITHM ANALYSIS AND DESIGN (3 cr.) (T) Topics of curret iterest i the desig ad aalysis of computer algorithms for graphtheoretical

More information

Lecture 3: Asymptotic Analysis + Recurrences

Lecture 3: Asymptotic Analysis + Recurrences Lecture 3: Asymptotic Aalysis + Recurreces Data Structures ad Algorithms CSE 373 SU 18 BEN JONES 1 Warmup Write a model ad fid Big-O for (it i = 0; i < ; i++) { for (it j = 0; j < i; j++) { System.out.pritl(

More information

(a) (b) All real numbers. (c) All real numbers. (d) None. to show the. (a) 3. (b) [ 7, 1) (c) ( 7, 1) (d) At x = 7. (a) (b)

(a) (b) All real numbers. (c) All real numbers. (d) None. to show the. (a) 3. (b) [ 7, 1) (c) ( 7, 1) (d) At x = 7. (a) (b) Chapter 0 Review 597. E; a ( + )( + ) + + S S + S + + + + + + S lim + l. D; a diverges by the Itegral l k Test sice d lim [(l ) ], so k l ( ) does ot coverge absolutely. But it coverges by the Alteratig

More information

Classification of problem & problem solving strategies. classification of time complexities (linear, logarithmic etc)

Classification of problem & problem solving strategies. classification of time complexities (linear, logarithmic etc) Classificatio of problem & problem solvig strategies classificatio of time complexities (liear, arithmic etc) Problem subdivisio Divide ad Coquer strategy. Asymptotic otatios, lower boud ad upper boud:

More information

HOMEWORK 2 SOLUTIONS

HOMEWORK 2 SOLUTIONS HOMEWORK SOLUTIONS CSE 55 RANDOMIZED AND APPROXIMATION ALGORITHMS 1. Questio 1. a) The larger the value of k is, the smaller the expected umber of days util we get all the coupos we eed. I fact if = k

More information

Fundamental Algorithms

Fundamental Algorithms Fudametal Algorithms Chapter 2b: Recurreces Michael Bader Witer 2014/15 Chapter 2b: Recurreces, Witer 2014/15 1 Recurreces Defiitio A recurrece is a (i-equality that defies (or characterizes a fuctio i

More information

Let us give one more example of MLE. Example 3. The uniform distribution U[0, θ] on the interval [0, θ] has p.d.f.

Let us give one more example of MLE. Example 3. The uniform distribution U[0, θ] on the interval [0, θ] has p.d.f. Lecture 5 Let us give oe more example of MLE. Example 3. The uiform distributio U[0, ] o the iterval [0, ] has p.d.f. { 1 f(x =, 0 x, 0, otherwise The likelihood fuctio ϕ( = f(x i = 1 I(X 1,..., X [0,

More information

2.2 Limits Involving Infinity AP Calculus

2.2 Limits Involving Infinity AP Calculus . Liits Ivolvig Iiity AP Calculus. LIMITS INVOLVING INFINITY We are goig to look at two kids o its ivolvig iiity. We are iterested i deteriig what happes to a uctio as approaches iiity (i both the positive

More information

Chapter 5. Inequalities. 5.1 The Markov and Chebyshev inequalities

Chapter 5. Inequalities. 5.1 The Markov and Chebyshev inequalities Chapter 5 Iequalities 5.1 The Markov ad Chebyshev iequalities As you have probably see o today s frot page: every perso i the upper teth percetile ears at least 1 times more tha the average salary. I other

More information

Are the following series absolutely convergent? n=1. n 3. n=1 n. ( 1) n. n=1 n=1

Are the following series absolutely convergent? n=1. n 3. n=1 n. ( 1) n. n=1 n=1 Absolute covergece Defiitio A series P a is called absolutely coverget if the series of absolute values P a is coverget. If the terms of the series a are positive, absolute covergece is the same as covergece.

More information

Basic Combinatorics. Math 40210, Section 01 Spring Homework 7 due Monday, March 26

Basic Combinatorics. Math 40210, Section 01 Spring Homework 7 due Monday, March 26 Basic Combiatorics Math 40210, Sectio 01 Sprig 2012 Homewor 7 due Moday, March 26 Geeral iformatio: I ecourage you to tal with your colleagues about homewor problems, but your fial write-up must be your

More information

STAT Homework 1 - Solutions

STAT Homework 1 - Solutions STAT-36700 Homework 1 - Solutios Fall 018 September 11, 018 This cotais solutios for Homework 1. Please ote that we have icluded several additioal commets ad approaches to the problems to give you better

More information

Chapter 2 The Solution of Numerical Algebraic and Transcendental Equations

Chapter 2 The Solution of Numerical Algebraic and Transcendental Equations Chapter The Solutio of Numerical Algebraic ad Trascedetal Equatios Itroductio I this chapter we shall discuss some umerical methods for solvig algebraic ad trascedetal equatios. The equatio f( is said

More information

Randomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)

Randomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018) Radomized Algorithms I, Sprig 08, Departmet of Computer Sciece, Uiversity of Helsiki Homework : Solutios Discussed Jauary 5, 08). Exercise.: Cosider the followig balls-ad-bi game. We start with oe black

More information

Discrete probability distributions

Discrete probability distributions Discrete probability distributios I the chapter o probability we used the classical method to calculate the probability of various values of a radom variable. I some cases, however, we may be able to develop

More information

Information Theory and Statistics Lecture 4: Lempel-Ziv code

Information Theory and Statistics Lecture 4: Lempel-Ziv code Iformatio Theory ad Statistics Lecture 4: Lempel-Ziv code Łukasz Dębowski ldebowsk@ipipa.waw.pl Ph. D. Programme 203/204 Etropy rate is the limitig compressio rate Theorem For a statioary process (X i)

More information

Problem Set 1 Solutions

Problem Set 1 Solutions V R N N N R f ] R S Itroductio to Algorithms September 12, 2003 Massachusetts Istitute of echology 6046J/18410J rofessors Shafi Goldwasser ad Silvio Micali Hadout 7 roblem Set 1 Solutios roblem 1-1 Recurrece

More information

Probability for mathematicians INDEPENDENCE TAU

Probability for mathematicians INDEPENDENCE TAU Probability for mathematicias INDEPENDENCE TAU 2013 28 Cotets 3 Ifiite idepedet sequeces 28 3a Idepedet evets........................ 28 3b Idepedet radom variables.................. 33 3 Ifiite idepedet

More information

Solutions to Tutorial 5 (Week 6)

Solutions to Tutorial 5 (Week 6) The Uiversity of Sydey School of Mathematics ad Statistics Solutios to Tutorial 5 (Wee 6 MATH2962: Real ad Complex Aalysis (Advaced Semester, 207 Web Page: http://www.maths.usyd.edu.au/u/ug/im/math2962/

More information

A Proof of Birkhoff s Ergodic Theorem

A Proof of Birkhoff s Ergodic Theorem A Proof of Birkhoff s Ergodic Theorem Joseph Hora September 2, 205 Itroductio I Fall 203, I was learig the basics of ergodic theory, ad I came across this theorem. Oe of my supervisors, Athoy Quas, showed

More information

ECEN 655: Advanced Channel Coding Spring Lecture 7 02/04/14. Belief propagation is exact on tree-structured factor graphs.

ECEN 655: Advanced Channel Coding Spring Lecture 7 02/04/14. Belief propagation is exact on tree-structured factor graphs. ECEN 655: Advaced Chael Codig Sprig 014 Prof. Hery Pfister Lecture 7 0/04/14 Scribe: Megke Lia 1 4-Cycles i Gallager s Esemble What we already kow: Belief propagatio is exact o tree-structured factor graphs.

More information

ITEC 360 Data Structures and Analysis of Algorithms Spring for n 1

ITEC 360 Data Structures and Analysis of Algorithms Spring for n 1 ITEC 360 Data Structures ad Aalysis of Algorithms Sprig 006 1. Prove that f () = 60 + 5 + 1 is Θ ( ). 60 + 5 + 1 60 + 5 + = 66 for 1 Take C 1 = 66 f () = 60 + 5 + 1 is O( ) Sice 60 + 5 + 1 60 for 1 If

More information

CS 332: Algorithms. Linear-Time Sorting. Order statistics. Slide credit: David Luebke (Virginia)

CS 332: Algorithms. Linear-Time Sorting. Order statistics. Slide credit: David Luebke (Virginia) 1 CS 332: Algorithms Liear-Time Sortig. Order statistics. Slide credit: David Luebke (Virgiia) Quicksort: Partitio I Words Partitio(A, p, r): Select a elemet to act as the pivot (which?) Grow two regios,

More information

TAYLOR AND MACLAURIN SERIES

TAYLOR AND MACLAURIN SERIES Calculus TAYLOR AND MACLAURIN SERIES Give a uctio ( ad a poit a, we wish to approimate ( i the eighborhood o a by a polyomial o degree. c c ( a c( a c( a P ( c ( a We have coeiciets to choose. We require

More information

Rademacher Complexity

Rademacher Complexity EECS 598: Statistical Learig Theory, Witer 204 Topic 0 Rademacher Complexity Lecturer: Clayto Scott Scribe: Ya Deg, Kevi Moo Disclaimer: These otes have ot bee subjected to the usual scrutiy reserved for

More information

Matriculation number: You have 90 minutes to complete the exam of InformatikIIb. The following rules apply:

Matriculation number: You have 90 minutes to complete the exam of InformatikIIb. The following rules apply: Departmet of Iformatics Prof. Dr. Michael Böhle Bizmühlestrasse 14 8050 Zurich Phoe: +41 44 635 4333 Email: boehle@ifi.uzh.ch AlgoDat Midterm1 Sprig 016 08.04.016 Name: Matriculatio umber: Advice You have

More information

Stochastic Processes

Stochastic Processes Stochastic Processes Review o Elemetar Probabilit Lecture I Hamid R. Rabiee Fall 20 Ali Jalali Outlie Histor/Philosoph Radom Variables Desit/Distributio Fuctios Joit/Coditioal Distributios Correlatio Importat

More information

INFINITE SEQUENCES AND SERIES

INFINITE SEQUENCES AND SERIES 11 INFINITE SEQUENCES AND SERIES INFINITE SEQUENCES AND SERIES 11.4 The Compariso Tests I this sectio, we will lear: How to fid the value of a series by comparig it with a kow series. COMPARISON TESTS

More information

OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES

OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES Peter M. Maurer Why Hashig is θ(). As i biary search, hashig assumes that keys are stored i a array which is idexed by a iteger. However, hashig attempts to bypass

More information

Lecture 7: October 18, 2017

Lecture 7: October 18, 2017 Iformatio ad Codig Theory Autum 207 Lecturer: Madhur Tulsiai Lecture 7: October 8, 207 Biary hypothesis testig I this lecture, we apply the tools developed i the past few lectures to uderstad the problem

More information

Subject: Differential Equations & Mathematical Modeling -III. Lesson: Power series solutions of Differential Equations. about ordinary points

Subject: Differential Equations & Mathematical Modeling -III. Lesson: Power series solutions of Differential Equations. about ordinary points Power series solutio of Differetial equatios about ordiary poits Subject: Differetial Equatios & Mathematical Modelig -III Lesso: Power series solutios of Differetial Equatios about ordiary poits Lesso

More information

Different kinds of Mathematical Induction

Different kinds of Mathematical Induction Differet ids of Mathematical Iductio () Mathematical Iductio Give A N, [ A (a A a A)] A N () (First) Priciple of Mathematical Iductio Let P() be a propositio (ope setece), if we put A { : N p() is true}

More information

It is often useful to approximate complicated functions using simpler ones. We consider the task of approximating a function by a polynomial.

It is often useful to approximate complicated functions using simpler ones. We consider the task of approximating a function by a polynomial. Taylor Polyomials ad Taylor Series It is ofte useful to approximate complicated fuctios usig simpler oes We cosider the task of approximatig a fuctio by a polyomial If f is at least -times differetiable

More information

Convergence of random variables. (telegram style notes) P.J.C. Spreij

Convergence of random variables. (telegram style notes) P.J.C. Spreij Covergece of radom variables (telegram style otes).j.c. Spreij this versio: September 6, 2005 Itroductio As we kow, radom variables are by defiitio measurable fuctios o some uderlyig measurable space

More information

Lecture 23 Rearrangement Inequality

Lecture 23 Rearrangement Inequality Lecture 23 Rearragemet Iequality Holde Lee 6/4/ The Iequalities We start with a example Suppose there are four boxes cotaiig $0, $20, $50 ad $00 bills, respectively You may take 2 bills from oe box, 3

More information

ECE-S352 Introduction to Digital Signal Processing Lecture 3A Direct Solution of Difference Equations

ECE-S352 Introduction to Digital Signal Processing Lecture 3A Direct Solution of Difference Equations ECE-S352 Itroductio to Digital Sigal Processig Lecture 3A Direct Solutio of Differece Equatios Discrete Time Systems Described by Differece Equatios Uit impulse (sample) respose h() of a DT system allows

More information

[ 11 ] z of degree 2 as both degree 2 each. The degree of a polynomial in n variables is the maximum of the degrees of its terms.

[ 11 ] z of degree 2 as both degree 2 each. The degree of a polynomial in n variables is the maximum of the degrees of its terms. [ 11 ] 1 1.1 Polyomial Fuctios 1 Algebra Ay fuctio f ( x) ax a1x... a1x a0 is a polyomial fuctio if ai ( i 0,1,,,..., ) is a costat which belogs to the set of real umbers ad the idices,, 1,...,1 are atural

More information

Part I: Covers Sequence through Series Comparison Tests

Part I: Covers Sequence through Series Comparison Tests Part I: Covers Sequece through Series Compariso Tests. Give a example of each of the followig: (a) A geometric sequece: (b) A alteratig sequece: (c) A sequece that is bouded, but ot coverget: (d) A sequece

More information

1 Review and Overview

1 Review and Overview CS9T/STATS3: Statistical Learig Theory Lecturer: Tegyu Ma Lecture #6 Scribe: Jay Whag ad Patrick Cho October 0, 08 Review ad Overview Recall i the last lecture that for ay family of scalar fuctios F, we

More information

Statistical Machine Learning II Spring 2017, Learning Theory, Lecture 7

Statistical Machine Learning II Spring 2017, Learning Theory, Lecture 7 Statistical Machie Learig II Sprig 2017, Learig Theory, Lecture 7 1 Itroductio Jea Hoorio jhoorio@purdue.edu So far we have see some techiques for provig geeralizatio for coutably fiite hypothesis classes

More information

Average-Case Analysis of QuickSort

Average-Case Analysis of QuickSort Average-Case Aalysis of QuickSort Comp 363 Fall Semester 003 October 3, 003 The purpose of this documet is to itroduce the idea of usig recurrece relatios to do average-case aalysis. The average-case ruig

More information

STRONG DEVIATION THEOREMS FOR THE SEQUENCE OF CONTINUOUS RANDOM VARIABLES AND THE APPROACH OF LAPLACE TRANSFORM

STRONG DEVIATION THEOREMS FOR THE SEQUENCE OF CONTINUOUS RANDOM VARIABLES AND THE APPROACH OF LAPLACE TRANSFORM Joural of Statitic: Advace i Theory ad Applicatio Volume, Number, 9, Page 35-47 STRONG DEVIATION THEORES FOR THE SEQUENCE OF CONTINUOUS RANDO VARIABLES AND THE APPROACH OF LAPLACE TRANSFOR School of athematic

More information

Notes 19 : Martingale CLT

Notes 19 : Martingale CLT Notes 9 : Martigale CLT Math 733-734: Theory of Probability Lecturer: Sebastie Roch Refereces: [Bil95, Chapter 35], [Roc, Chapter 3]. Sice we have ot ecoutered weak covergece i some time, we first recall

More information

Topics. Homework Problems. MATH 301 Introduction to Analysis Chapter Four Sequences. 1. Definition of convergence of sequences.

Topics. Homework Problems. MATH 301 Introduction to Analysis Chapter Four Sequences. 1. Definition of convergence of sequences. MATH 301 Itroductio to Aalysis Chapter Four Sequeces Topics 1. Defiitio of covergece of sequeces. 2. Fidig ad provig the limit of sequeces. 3. Bouded covergece theorem: Theorem 4.1.8. 4. Theorems 4.1.13

More information

Lecture 2: Concentration Bounds

Lecture 2: Concentration Bounds CSE 52: Desig ad Aalysis of Algorithms I Sprig 206 Lecture 2: Cocetratio Bouds Lecturer: Shaya Oveis Ghara March 30th Scribe: Syuzaa Sargsya Disclaimer: These otes have ot bee subjected to the usual scrutiy

More information

Chapter 22 Developing Efficient Algorithms

Chapter 22 Developing Efficient Algorithms Chapter Developig Efficiet Algorithms 1 Executig Time Suppose two algorithms perform the same task such as search (liear search vs. biary search). Which oe is better? Oe possible approach to aswer this

More information

Lecture 3 : Random variables and their distributions

Lecture 3 : Random variables and their distributions Lecture 3 : Radom variables ad their distributios 3.1 Radom variables Let (Ω, F) ad (S, S) be two measurable spaces. A map X : Ω S is measurable or a radom variable (deoted r.v.) if X 1 (A) {ω : X(ω) A}

More information