Asymptotics & Stirling’s Approximation

Slides:



Advertisements
Similar presentations
CMSC 341 Asymptotic Analysis. 2 Mileage Example Problem: John drives his car, how much gas does he use?
Advertisements

 The running time of an algorithm as input size approaches infinity is called the asymptotic running time  We study different notations for asymptotic.
Discrete Mathematics CS 2610 February 26, part 1.
Discrete Structures & Algorithms Functions & Asymptotic Complexity.
The Growth of Functions
Asymptotic Growth Rate
Cutler/HeadGrowth of Functions 1 Asymptotic Growth Rate.
25 June 2015Comp 122, Spring 2004 Asymptotic Notation, Review of Functions & Summations.
Asymptotic Analysis Motivation Definitions Common complexity functions
Chapter 2: Fundamentals of the Analysis of Algorithm Efficiency
Chapter 2: Algorithm Analysis Big-Oh and Other Notations in Algorithm Analysis Lydia Sinapova, Simpson College Mark Allen Weiss: Data Structures and Algorithm.
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part 2. Types of Complexities.
CSE 373 Data Structures and Algorithms Lecture 4: Asymptotic Analysis II / Math Review.
Algorithm analysis and design Introduction to Algorithms week1
CS 3343: Analysis of Algorithms
Asymptotic Analysis-Ch. 3
1 o-notation For a given function g(n), we denote by o(g(n)) the set of functions: o(g(n)) = {f(n): for any positive constant c > 0, there exists a constant.
Algorithm Analysis CS 400/600 – Data Structures. Algorithm Analysis2 Abstract Data Types Abstract Data Type (ADT): a definition for a data type solely.
Design and Analysis of Algorithms Chapter Asymptotic Notations* Dr. Ying Lu August 30, RAIK.
Chapter 5 Algorithms (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Time Complexity of Algorithms (Asymptotic Notations)
General rules: Find big-O f(n) = k = O(1) f(n) = a k n k + a k-1 n k a 1 n 1 + a 0 = O(n k ) Other functions, try to find the dominant term according.
COP 3530 Spring2012 Data Structures & Algorithms Discussion Session Week 5.
Asymptotics and Recurrence Equations Prepared by John Reif, Ph.D. Analysis of Algorithms.
13 February 2016 Asymptotic Notation, Review of Functions & Summations.
Algorithms Lecture #05 Uzair Ishtiaq. Asymptotic Notation.
DR. Gatot F. Hertono, MSc. Design and Analysis of ALGORITHM (Session 2)
Lecture 7. Asymptotic definitions for the analysis of algorithms 1.
1 Section 5.6 Comparing Rates of Growth We often need to compare functions ƒ and g to see whether ƒ(n) and g(n) are about the same or whether one grows.
Ch03-Algorithms 1. Algorithms What is an algorithm? An algorithm is a finite set of precise instructions for performing a computation or for solving a.
Mathematical Foundations (Growth Functions) Neelima Gupta Department of Computer Science University of Delhi people.du.ac.in/~ngupta.
Asymptotic Complexity
nalisis de lgoritmos A A
Asymptotic Analysis.
Introduction to Algorithms
Analysis of Algorithms & Orders of Growth
Week 2 - Friday CS221.
The Growth of Functions
Computational Processes
Asymptotic Growth Rate
Asymptotics & Stirling’s Approximation
BIG-OH AND OTHER NOTATIONS IN ALGORITHM ANALYSIS
Asymptotic Analysis.
Fundamentals of Algorithms MCS - 2 Lecture # 9
Chapter 2: Fundamentals of the Analysis of Algorithm Efficiency
CS 3343: Analysis of Algorithms
Orders of Growth Rosen 5th ed., §2.2.
and Structural Induction II
Advanced Analysis of Algorithms
Chapter 2.
and Structural Induction II
Mathematics for Computer Science MIT 6.042J/18.062J
Mathematics for Computer Science MIT 6.042J/18.062J
and Structural Induction
Performance Evaluation
Asymptotics & Stirling’s Approximation
Asymptotics & Stirling’s Approximation
Combinations and Pascal’s triangle
Advanced Algorithms Analysis and Design
Asymptotics & Stirling’s Approximation
CSE 373, Copyright S. Tanimoto, 2001 Asymptotic Analysis -
MASTER THEOREM.
Lecture 44 Section 9.2 Mon, Apr 23, 2007
Algorithms CSCI 235, Spring 2019 Lecture 3 Asymptotic Analysis
Advanced Analysis of Algorithms
Big Omega, Theta Defn: T(N) = (g(N)) if there are positive constants c and n0 such that T(N)  c g(N) for all N  n0 . Lingo: “T(N) grows no slower than.
Algorithm Course Dr. Aref Rashad
Presentation transcript:

Asymptotics & Stirling’s Approximation Mathematics for Computer Science MIT 6.042J/18.062J Asymptotics & Stirling’s Approximation Copyright © Albert Meyer, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal

Factorial defines a product: Integral Method Factorial defines a product: Turn product into a sum taking logs: ln(n!) = ln(1 · 2 · 3 · · · (n – 1) · n) = ln 1 + ln 2 +· · · + ln(n – 1) + ln(n) =

… bound by integral method Integral Method ln (x) … ln (x+1) ln ln n 2 3 1 4 5 n–2 n–1 n … ln (x+1) ln (x) … ln 2 ln 3 ln 4 ln 5 ln n-1 ln n

Integral Method Reminder:

Integral Method Bounds on ln(n!)

In-Class Problem Problem 1

Stirling’s Formula So

Stirling’s Formula A precise approximation: Stirling’s Formula

Asymptotic Equivalence f(n) ~ g(n)

Little Oh Asymptotically smaller: f(n) = o(g(n))

Big Oh Asymptotic Order of Growth: f(n) = O(g(n))

The Oh’s If f = o(g) or f ~ g then f = O(g) lim = 0 lim = 1 lim < 

The Oh’s If f = o(g), then g  O(f) lim =  lim = 0

c,n0  0 n  n0 |f(n)|  c·g(n) Big Oh Equivalently, f(n) = O(g(n)) c,n0  0 n  n0 |f(n)|  c·g(n)

Asymptotic Notation f(x) = O(g(x)) +c c g(x) blue stays below red f(x)

Lemma: xa = o(xb) for a < b Little Oh Lemma: xa = o(xb) for a < b Proof: and b - a > 0. So as x  , xb-a   and .

Lemma: ln x = o(x) for  > 0. Little Oh Lemma: ln x = o(x) for  > 0. Proof: for z 1.

Lemma: ln x = o(x) for  > 0. Little Oh Lemma: ln x = o(x) for  > 0. Proof: Let for  > .

f(n) = O(g(n)) and g(n) = O(f(n)) Theta Same Order of Growth: f(n) = (g(n)) f(n) = O(g(n)) and g(n) = O(f(n))

In-Class Problem Problems 2--4

Big Oh Mistakes False Lemma: Of course really

= n· O(1) = O(n). 0 = O(1), 1 = O(1), 2 = O(1),… So each i = O(1). So Big Oh Mistakes False Lemma: False Proof: 0 = O(1), 1 = O(1), 2 = O(1),… So each i = O(1). So = n· O(1) = O(n).

In-Class Problem Problem 5