225_05_divide_and_conquer

225_05_divide_and_conquer -...

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

View Full Document Right Arrow Icon
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.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Review of linked lists
Background image of page 2
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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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]
Background image of page 4
Image of page 5
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 Right Arrow Icon
Ask a homework question - tutors are online