# 3-twoup - Asymptotic Notation In order to express algorithm...

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Asymptotic Notation In order to express algorithm performance, we need a notation that • ignores constant factors; and • focuses on the behavior as the size of the input increases. Defn: Let f : N → R ≥ . O ( f ( n )) is the set of all functions g : N → R ≥ such that for some natural number n and some strictly positive real number c , g ( n ) ≤ cf ( n ) whenever n ≥ n . 1 Examples • 2 n 2 ∈ O ( n 2 ) . • 3 n 2 + 17 n + 350 ∈ O ( n 2 ) . • n 2 negationslash∈ O ( n ) . • O ( n 2 + 5 n ) ⊆ O (2 n 2 + 4) . • O (2 n 2 + 4) ⊆ O ( n 2 + 5 n ) . • O (2 n 2 + 4) = O ( n 2 + 5 n ) . • O ( n ) ⊆ O ( n 2 ) . • O ( n ) negationslash = O ( n 2 ) . 2 Precondition: A [0 ..n − 1] is an array of Number s, n is a Nat . Postcondition: Returns the maximum subsequence sum of A . MaxSumBU ( A [0 ..n − 1] ) m ← 0; msuf ← // Invariant: m is the maximum subsequence sum // of A [0 ..i − 1] , // msuf is the maximum suffix sum for A [0 ..i − 1] for i ← to n − 1 msuf ← Max (0 , msuf + A [ i ]) m ← Max ( m, msuf ) return m 3 Theorem 3.8 Suppose f 1 ( n ) ∈ O ( g 1 ( n )) and f 2 ( n ) ∈ O ( g 2 ( n )) . Then 1. f 1 ( n...
View Full Document

{[ snackBarMessage ]}

### Page1 / 9

3-twoup - Asymptotic Notation In order to express algorithm...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online