{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# L13_Adv_DandC - COMP170 Discrete Mathematical Tools for...

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

1-1 Dealing with floors and ceilings in divide-and-conquer recurrences COMP170 Discrete Mathematical Tools for Computer Science

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

View Full Document
2-1 We have seen that when n is a power of 2 . T ( n ) = 2 T ( n/ 2) + n if n 2 , 1 if n = 1 . is n (log 2 n + 1) . What happens when n is not a power of 2 ? (*)
2-2 Note that, when n is not a power of 2 , a D&C recurrence will split n into n/ 2 and n/ 2 . Eq (*) then becomes We have seen that when n is a power of 2 . T ( n ) = 2 T ( n/ 2) + n if n 2 , 1 if n = 1 . is n (log 2 n + 1) . What happens when n is not a power of 2 ? (*) T ( n ) = T ( n/ 2 ) + T ( n/ 2 ) + n if n 2 , 1 if n = 1 . (**)

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

View Full Document
2-3 Note that, when n is not a power of 2 , a D&C recurrence will split n into n/ 2 and n/ 2 . Eq (*) then becomes We have seen that when n is a power of 2 . T ( n ) = 2 T ( n/ 2) + n if n 2 , 1 if n = 1 . is n (log 2 n + 1) . What happens when n is not a power of 2 ? (*) T ( n ) = T ( n/ 2 ) + T ( n/ 2 ) + n if n 2 , 1 if n = 1 . When n is a power of 2 then (**) is defined by (*) . (**)
3-1 Assume the following Theorem (to be proven later): Theorem 1 If n 1 n 2 , then T ( n 1 ) T ( n 2 )

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

View Full Document
3-2 Assume the following Theorem (to be proven later): Theorem 1 If n 1 n 2 , then T ( n 1 ) T ( n 2 ) Let m = 2 i +1 be the smallest power of 2 n . Since the interval [ n, 2 n - 1] contains a power of 2 we have m < 2 n . So, T ( n ) T ( m ) = m (1 + log 2 m ) 2 n (1 + log 2 2 n ) = 2 n (2 + log 2 n )
3-3 Assume the following Theorem (to be proven later): Theorem 1 If n 1 n 2 , then T ( n 1 ) T ( n 2 ) Let m = 2 i +1 be the smallest power of 2 n . Since the interval

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.

{[ snackBarMessage ]}

### Page1 / 25

L13_Adv_DandC - COMP170 Discrete Mathematical Tools for...

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

View Full Document
Ask a homework question - tutors are online