11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

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.

15Lower BoundsHow do I know if I have a good algorithm to solve a problem? If my algorithm runsin Θ(n log n) time, is th<strong>at</strong> good? It would be if I were sorting the records storedin an array. But it would be terrible if I were searching the array for the largestelement. The value of an algorithm must be determined in rel<strong>at</strong>ion to the inherentcomplexity of the problem <strong>at</strong> h<strong>and</strong>.In Section 3.6 we defined the upper bound for a problem to be the upper boundof the best algorithm we know for th<strong>at</strong> problem, <strong>and</strong> the lower bound to be thetightest lower bound th<strong>at</strong> we can prove over all algorithms for th<strong>at</strong> problem. Whilewe usually can recognize the upper bound for a given algorithm, finding the tightestlower bound for all possible algorithms is often difficult, especially if th<strong>at</strong> lowerbound is more than the “trivial” lower bound determined by measuring the amountof input th<strong>at</strong> must be processed.The benefits of being able to discover a strong lower bound are significant. Inparticular, when we can make the upper <strong>and</strong> lower bounds for a problem meet, thismeans th<strong>at</strong> we truly underst<strong>and</strong> our problem in a theoretical sense. It also savesus the effort of <strong>at</strong>tempting to discover more (asymptotically) efficient algorithmswhen no such algorithm can exist.Often the most effective way to determine the lower bound for a problem isto find a reduction to another problem whose lower bound is already known. Thisis the subject of Chapter 17. However, this approach does not help us when wecannot find a suitable “similar problem.” Our focus in this chapter is discovering<strong>and</strong> proving lower bounds from first principles. Our most significant example ofa lower bounds argument so far is the proof from Section 7.9 th<strong>at</strong> the problem ofsorting is O(n log n) in the worst case.Section 15.1 reviews the concept of a lower bound for a problem <strong>and</strong> presentsthe basic “algorithm” for finding a good algorithm. Section 15.2 discusses lowerbounds on searching in lists, both those th<strong>at</strong> are unordered <strong>and</strong> those th<strong>at</strong> are ordered.Section 15.3 deals with finding the maximum value in a list, <strong>and</strong> presents amodel for selection based on building a partially ordered set. Section 15.4 presents485

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

Saved successfully!

Ooh no, something went wrong!