04.09.2013 Views

Algorithm Design

Algorithm Design

Algorithm Design

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

220<br />

Chapter 5 Divide and Conquer<br />

most of the work is spent in the recursion: when q = 1, the total running time<br />

is dominated by the top level, whereas when q > 2 it’s dominated by the work<br />

done on constant-size subproblems at the bottom of the recursion. Viewed this<br />

way, we can appreciate that the recurrence for q = 2 really represents a "knifeedge"--the<br />

amount of work done at each level is exactly the same, which is<br />

what yields the O(n log n) running time.<br />

A Related Recurrence: T(n) 2, and<br />

T(n)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!