CS300-02_Algorithm_Analysis - Lower Bounds and the...

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

View Full Document Right Arrow Icon
11 Lower Bounds and the Complexity of Problems P 1: Given n numbers, read and print them in the reverse order. Can you solve this problem in less than O( n ) time ? P 2: Given two polygons with n vertices, construct its intersection. Can you solve this problem in less than O( n 2) time ? Well, … O( n 2) points
Background image of page 1

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

View Full DocumentRight Arrow Icon
22 P 3: Given a value x and an array L containing n entries sorted in the ascend- ing order, find an index of x in the list or return 0 as the answer if x is not in the list. Can you solve this problem in less than O(log n ) time ? Definition : (worst-case tight) Lower bound A lower bound in time complexity of a problem is the least amount of time to solve the most difficult instance of the problem. Trivial lower bound input / output Non-trivial lower bound hard to obtain
Background image of page 2
33 How to Obtain a Lower Bound P : Given a list of n numbers, find the largest one. P′ : Given a list of n distinct numbers, find the largest one. 1 A lower bound for P′ is also a lower bound for P . (although it may not be tight)
Background image of page 3

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

View Full DocumentRight Arrow Icon
44 What is a lower bound for P′ ? (1) Trivial lower bound: c T n, c > 0 Why ? (2) Winner / loser argument 1 loser / comparison To determine the largest one, n - 1 losers must be set aside. 1 ( n - 1) comparisons are required. (3) (By adversary argument) Fewer than n-1 comparisons 1 Two non-losers including the winner Contradiction Why ? 1 L ( P′ ) = c n Since P′n P , L ( P ) = c n
Background image of page 4
55 Finding a Lower Bound Direct method Examining the size of an input / output Finding a lower bound for an instance of a problem Decision tree Indirect method Via reducibility (transformability) Note: There are many other ways.
Background image of page 5

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

View Full DocumentRight Arrow Icon
: Given input (problem instance) I , find a solution for I . D
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 26

CS300-02_Algorithm_Analysis - Lower Bounds and the...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online