{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lec2 - EE 608 Computational Models and Methods Lecture 2...

This preview shows pages 1–9. Sign up to view the full content.

EE 608: Computational Models and Methods Lecture 2: Asymptotics and Mathematical Basics Read Chapter 3 of Introduction to Algorithms

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Θ -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 0 such that 0 c 1 g ( n ) f ( n ) c 2 g ( n ) , n n 0 } n n0 c2 g(n) f(n) c1 g(n) Though we write f ( n ) = Θ( g ( n )), technically this means f ( n ) Θ( g ( n )).
Discussion of the Asymptotic Notation A very useful aspect of this notation is that constants and lower-order 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 = Θ( n 2 ). Proof by contradiction: i.e., assume 6 n 3 = Θ( n 2 ). 0 c 1 n 2 6 n 3 c 2 n 2 , n n 0 0 c 1 6 n c 2 , n n 0 This implies that n c 2 6 , n n 0 , a contradiction.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Θ -Notation Example 1 f ( n ) = 5 n 2 + 1000 n Claim: f ( n ) = Θ( n 2 ) Needed: c 1 , c 2 , and n 0 , such that: 0 c 1 n 2 5 n 2 + 1000 n c 2 n 2 0 c 1 5 + 1000 n c 2 One choice: n 0 = 1000 , c 1 = 5 , c 2 = 6
Θ -Notation Example 2 Let us try to prove that n = Θ( n 2 ). Proof by contradiction: i.e., assume n = Θ( n 2 ). 0 c 1 n 2 n c 2 n 2 , n n 0 0 c 1 1 n c 2 , n n 0 This implies that n 1 c 1 , n n 0 , a contradiction.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
O -Notation If we want to express only the asymptotic upper bound of a function, we can use O -notation. Formally: O ( g ( n )) = { f ( n ) | ∃ positive constants c, n 0 such that 0 f ( n ) cg ( n ) , n n 0 } n n0 f(n) c g(n) For example, 5 n 2 + 100 n + 22 = O ( n 2 ) and n = O ( n 2 ). Since O -notation 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.
Ω -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 0 such that 0 cg ( n ) f ( n ) , n n 0 } 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.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Discussion of the Asymptotic Notation continued Theorem 2.1. For any two functions f ( n ) and g ( n ), f ( n ) = Θ( g ( n )) iff f ( n ) = O ( g ( n )) and f ( n ) = Ω( g ( n )). Θ-notation is a stronger than O -notation: Θ( g ( n )) O ( g ( n )).
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}