225_05_divide_and_conquer

# 225_05_divide_and_conquer -...

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

1 Consider this recurrence which is only defined for values of n= 2 k   for some integer k ≥ 1: T(2) = 5 T(n) = 7 * n  + T(n/2) 1. Solve this recurrence using repeated substitution. 2. Try proving that your answer is correct by induction to see if  you obtained a correct solution or not.

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

View Full Document
3 Divide and Conquer 1. Divide the problem into two or more subproblems. 2. Solve the subproblems. 3. Marry the solutions. This is one of the most common problem solving tactics  and leads naturally to recursive algorithms.

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

View Full Document
Merge Sort- with linked lists [Basis]  If the list has size 0 or 1 it is already sorted so  return. [Divide]  Otherwise, split the list into two lists, list1  and list 2, of roughly equal sizes. [Conquer]  Sort list1 and list2 (recursively). [Marry solutions]
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/15/2012 for the course CSC 225 taught by Professor Valerieking during the Spring '10 term at University of Victoria.

### Page1 / 13

225_05_divide_and_conquer -...

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

View Full Document
Ask a homework question - tutors are online