23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

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.

11.1.5. Merge-Sort <strong>and</strong> Recurrence Equations <br />

There is another way to justify that the runn<strong>in</strong>g time of the merge-sort algorithm is<br />

O(n log n) (Proposition 11.2). Namely, we can deal more directly with the recursive<br />

nature of the merge-sort algorithm. In this section, we present such an analysis of<br />

the runn<strong>in</strong>g time of merge-sort, <strong>and</strong> <strong>in</strong> so do<strong>in</strong>g <strong>in</strong>troduce the mathematical concept<br />

of a recurrence equation (also known as recurrence relation).<br />

Let the function t(n) denote the worst-case runn<strong>in</strong>g time of merge-sort on an <strong>in</strong>put<br />

sequence of size n. S<strong>in</strong>ce merge-sort is recursive, we can characterize function t(n)<br />

by means of an equation where the function t(n) is recursively expressed <strong>in</strong> terms of<br />

itself. In order to simplify our characterization of t (n), let us restrict our attention to<br />

692

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

Saved successfully!

Ooh no, something went wrong!