This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: EE 608: Computational Models and Methods Lecture 2: Asymptotics and Mathematical Basics Read Chapter 3 of Introduction to Algorithms ECE 608, Fall 2005 [ 1 ] ΘNotation We describe asymptotic running times of algorithms using functions with do mains of natural numbers. This notation is convenient for defining the worst case running time function, T ( n ). Θ( g ( n )) represents an asymptotically tight bound , which is defined formally as a set: Θ( g ( n )) = { f ( n )  ∃ positive constants c 1 , c 2 , n such that ≤ c 1 g ( n ) ≤ f ( n ) ≤ c 2 g ( n ) , ∀ n ≥ n } n n0 c2 g(n) f(n) c1 g(n) Though we write f ( n ) = Θ( g ( n )), technically this means f ( n ) ∈ Θ( g ( n )). ECE 608, Fall 2005 [ 2 ] Discussion of the Asymptotic Notation • A very useful aspect of this notation is that constants and lowerorder terms can be ignored. • How does one work with this notation? We will learn a number of rules for their manipulation. If they don’t help, remember the definition for Θ. • For example, let us try to prove that 6 n 3 6 = Θ( n 2 ). Proof by contradiction: i.e., assume 6 n 3 = Θ( n 2 ). ≤ c 1 n 2 ≤ 6 n 3 ≤ c 2 n 2 , ∀ n ≥ n ≤ c 1 ≤ 6 n ≤ c 2 , ∀ n ≥ n This implies that n ≤ c 2 6 , ∀ n ≥ n , a contradiction. ECE 608, Fall 2005 [ 3 ] ΘNotation Example 1 f ( n ) = 5 n 2 + 1000 n Claim: f ( n ) = Θ( n 2 ) Needed: c 1 , c 2 , and n , such that: ≤ c 1 n 2 ≤ 5 n 2 + 1000 n ≤ c 2 n 2 ≤ c 1 ≤ 5 + 1000 n ≤ c 2 One choice: n = 1000 , c 1 = 5 , c 2 = 6 ECE 608, Fall 2005 [ 4 ] ΘNotation Example 2 Let us try to prove that n 6 = Θ( n 2 ). Proof by contradiction: i.e., assume n = Θ( n 2 ). ≤ c 1 n 2 ≤ n ≤ c 2 n 2 , ∀ n ≥ n ≤ c 1 ≤ 1 n ≤ c 2 , ∀ n ≥ n This implies that n ≤ 1 c 1 , ∀ n ≥ n , a contradiction. ECE 608, Fall 2005 [ 5 ] ONotation If we want to express only the asymptotic upper bound of a function, we can use Onotation. Formally: O ( g ( n )) = { f ( n )  ∃ positive constants c, n such that ≤ f ( n ) ≤ cg ( n ) , ∀ n ≥ n } n n0 f(n) c g(n) For example, 5 n 2 + 100 n + 22 = O ( n 2 ) and n = O ( n 2 ). Since Onotation describes an upper bound, when we use it to bound the worst case running time of an algorithm, we also bound the running time on arbitrary inputs. ECE 608, Fall 2005 [ 6 ] ΩNotation If we want to express only the asymptotic lower bound of a function, we can use Ωnotation. Formally: Ω( g ( n )) = { f ( n )  ∃ positive constants c, n such that ≤ cg ( n ) ≤ f ( n ) , ∀ n ≥ n } n n0 f(n) c g(n) For example, 5 n 2 + 100 n + 22 = Ω( n 2 ) and n 2 = Ω( n ). Since Ωnotation describes a lower bound, when we use it to bound the best case running time of an algorithm, we also bound the running time on arbitrary inputs....
View
Full
Document
This note was uploaded on 04/07/2011 for the course ECE 608 taught by Professor Mithuna during the Fall '07 term at Purdue.
 Fall '07
 Mithuna
 Algorithms

Click to edit the document details