Solutions of Theory of Algorithms assignment 9.3-1

Solutions of Theory of Algorithms assignment 9.3-1 - x is...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Solutions of Theory of Algorithms Assignment 5 Exercise 9.3-1 If we divide the elements into groups of 7, Thus, at least half of the n /7 groups contribute 4 elements that are greater than x , except for the one group that has fewer than 7 elements if 7 does not divide n exactly, and the one group containing x itself. Discounting these two groups, it follows that the number of elements greater than
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x is at least 4(1/2-n7 2 )>= 2n/7 – 8 Then the recurrence will be T(n) <= T(n/7) + T(5n/7 + 8) + O(n) It can be solved by substitution like the solution in the book which shows us it is linear. If we divide the elements into groups of 3, the number of elements greater than x is at least 2(1/2(n/3) -2) >= n/3-4 Then the recurrence will be T(n) <= T(n/3) + T(2n/3 + 4) + O(n)...
View Full Document

This note was uploaded on 11/09/2010 for the course CS 11841 taught by Professor Dr.ayman during the Spring '09 term at Alexandria University.

Ask a homework question - tutors are online