12.DivideAndConquer_outside

# Log is then log is if 2 is then is if 1 log 1 log log

This preview shows pages 10–16. Sign up to view the full content.

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

View Full Document

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

View Full Document

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: ) log ( is ) ( then ), log ( is ) ( if 2. ) ( is ) ( then ), ( is ) ( if 1. log 1 log log log log n f b n af n f n T n n f n n n T n n n f n n T n O n f a k a k a a a b b b b b n n T n T ) 2 / ( 4 ) ( Solution: log b a=2, so case 1 says T(n) is O(n 2 ). © 2004 Goodrich, Tamassia Divide-and-Conquer 11 Master Method, Example 2 The form: The Master Theorem: Example: d n n f b n aT d n c n T if ) ( ) / ( if ) ( . 1 some for ) ( ) / ( provided )), ( ( is ) ( then ), ( is ) ( if 3. ) log ( is ) ( then ), log ( is ) ( if 2. ) ( is ) ( then ), ( is ) ( if 1. log 1 log log log log n f b n af n f n T n n f n n n T n n n f n n T n O n f a k a k a a a b b b b b n n n T n T log ) 2 / ( 2 ) ( Solution: log b a=1, so case 2 says T(n) is O(n log 2 n). © 2004 Goodrich, Tamassia Divide-and-Conquer 12 Master Method, Example 3 The form: The Master Theorem: Example: d n n f b n aT d n c n T if ) ( ) / ( if ) ( . 1 some for ) ( ) / ( provided )), ( ( is ) ( then ), ( is ) ( if 3. ) log ( is ) ( then ), log ( is ) ( if 2. ) ( is ) ( then ), ( is ) ( if 1. log 1 log log log log n f b n af n f n T n n f n n n T n n n f n n T n O n f a k a k a a a b b b b b n n n T n T log ) 3 / ( ) ( Solution: log b a=0, so case 3 says T(n) is O(n log n). © 2004 Goodrich, Tamassia Divide-and-Conquer 13 Master Method, Example 4 The form: The Master Theorem: Example: d n n f b n aT d n c n T if ) ( ) / ( if ) ( . 1 some for ) ( ) / ( provided )), ( ( is ) ( then ), ( is ) ( if 3. ) log ( is ) ( then ), log ( is ) ( if 2. ) ( is ) ( then ), ( is ) ( if 1. log 1 log log log log n f b n af n f n T n n f n n n T n n n f n n T n O n f a k a k a a a b b b b b 2 ) 2 / ( 8 ) ( n n T n T Solution: log b a=3, so case 1 says T(n) is O(n 3 ). © 2004 Goodrich, Tamassia Divide-and-Conquer 14 Master Method, Example 5 The form: The Master Theorem: Example: d n n f b n aT d n c n T if ) ( ) / ( if ) ( . 1 some for ) ( ) / ( provided )), ( ( is ) ( then ), ( is ) ( if 3. ) log ( is ) ( then ), log ( is ) ( if 2. ) ( is ) ( then ), ( is ) ( if 1. log 1 log log log log n f b n af n f n T n n f n n n T n n n f n n T n O n f a k a k a a a b b b b b 3 ) 3 / ( 9 ) ( n n T n T Solution: log b a=2, so case 3 says T(n) is O(n 3 ). © 2004 Goodrich, Tamassia Divide-and-Conquer 15 Master Method, Example 6 The form:...
View Full Document

{[ snackBarMessage ]}

### Page10 / 19

log is then log is if 2 is then is if 1 log 1 log log log...

This preview shows document pages 10 - 16. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online