The Lower Bounds of Problems

Slides:



Advertisements
Similar presentations
110/6/2014CSE Suprakash Datta datta[at]cse.yorku.ca CSE 3101: Introduction to the Design and Analysis of Algorithms.
Advertisements

CS420 lecture one Problems, algorithms, decidability, tractability.
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
© The McGraw-Hill Companies, Inc., Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Chapter 1 – Basic Concepts
1 ICS 353 Design and Analysis of Algorithms Spring Semester (062) King Fahd University of Petroleum & Minerals Information & Computer Science.
CS 253: Algorithms Chapter 8 Sorting in Linear Time Credit: Dr. George Bebis.
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
1 -1 Chapter 1 Introduction Why Do We Need to Study Algorithms? To learn strategies to design efficient algorithms. To understand the difficulty.
2 -1 Analysis of algorithms Best case: easiest Worst case Average case: hardest.
CPSC 411, Fall 2008: Set 2 1 CPSC 311 Analysis of Algorithms Sorting Lower Bound Prof. Jennifer Welch Fall 2009.
Lecture 5: Master Theorem and Linear Time Sorting
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
1 -1 Chapter 1 Introduction Why to study algorithms? Sorting problem: To sort a set of elements into increasing or decreasing order. 11, 7, 14,
DAST 2005 Week 4 – Some Helpful Material Randomized Quick Sort & Lower bound & General remarks…
The Complexity of Algorithms and the Lower Bounds of Problems
Insertion Sort CSE 331 Section 2 James Daly. Insertion Sort Basic idea: keep a sublist sorted, then add new items into the correct place to keep it sorted.
Algorithm analysis and design Introduction to Algorithms week1
Lecture 2 We have given O(n 3 ), O(n 2 ), O(nlogn) algorithms for the max sub-range problem. This time, a linear time algorithm! The idea is as follows:
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Mathematics Review and Asymptotic Notation
CS 1704 Introduction to Data Structures and Software Engineering.
The Lower Bounds of Problems
Analysis techniques Pasi Fränti Ordo O(g) – Upper Bound f(n) ≤ c∙g(n) Omega  (g)– Lower Bound f(n) ≥ c∙g(n) Theta Θ(g)– Exact limit: c 1 ∙g(n)
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
Chapter 18: Searching and Sorting Algorithms. Objectives In this chapter, you will: Learn the various search algorithms Implement sequential and binary.
Time Complexity of Algorithms (Asymptotic Notations)
LIMITATIONS OF ALGORITHM POWER
Data Structures Haim Kaplan & Uri Zwick December 2013 Sorting 1.
Lecture 14 Lower Bounds Decision tree model Linear-time reduction.
Lecture 9COMPSCI.220.FS.T Lower Bound for Sorting Complexity Each algorithm that sorts by comparing only pairs of elements must use at least 
© The McGraw-Hill Companies, Inc., Chapter 1 Introduction.
Sorting Lower Bounds n Beating Them. Recap Divide and Conquer –Know how to break a problem into smaller problems, such that –Given a solution to the smaller.
Algorithms Lecture #05 Uzair Ishtiaq. Asymptotic Notation.
1 Asymptotes: Why? How to describe an algorithm’s running time? (or space, …) How does the running time depend on the input? T(x) = running time for instance.
1 Chapter 8-1: Lower Bound of Comparison Sorts. 2 About this lecture Lower bound of any comparison sorting algorithm – applies to insertion sort, selection.
Sorting Lower Bound 4/25/2018 8:49 PM
Analysis of Non – Recursive Algorithms
Analysis of Non – Recursive Algorithms
Introduction to Algorithms: Asymptotic Notation
Decision trees Polynomial-Time
Trees.
CPSC 411 Design and Analysis of Algorithms
Optimal Algorithms Search and Sort.
CSCE 411 Design and Analysis of Algorithms
(2,4) Trees 11/15/2018 9:25 AM Sorting Lower Bound Sorting Lower Bound.
The Complexity of Algorithms and the Lower Bounds of Problems
CSCE 411 Design and Analysis of Algorithms
Final Exam Review COP4530.
Asymptotes: Why? How to describe an algorithm’s running time?
(2,4) Trees 12/4/2018 1:20 PM Sorting Lower Bound Sorting Lower Bound.
CS200: Algorithm Analysis
Analysys & Complexity of Algorithms
Advanced Analysis of Algorithms
Chapter 11 Limitations of Algorithm Power
Data Structures Sorting Haim Kaplan & Uri Zwick December 2014.
(2,4) Trees 2/28/2019 3:21 AM Sorting Lower Bound Sorting Lower Bound.
Topic 5: Heap data structure heap sort Priority queue
Lower bound for sorting, radix sort
CMPS 3120: Computational Geometry Spring 2013
G.PULLAIAH COLLEGE OF ENGINEERING AND TECHNOLOGY
CPSC 411 Design and Analysis of Algorithms
Introduction To Algorithms
Chapter 1 Introduction.
Chapter 8: Overview Comparison sorts: algorithms that sort sequences by comparing the value of elements Prove that the number of comparison required to.
CS 583 Analysis of Algorithms
Advanced Analysis of Algorithms
Complexity Analysis (Part II)
Presentation transcript:

The Lower Bounds of Problems 2012/11/6

Lower bound Def : A lower bound of a problem is the least time complexity required for any algorithm which can be used to solve this problem. ☆ worst case lower bound ☆ average case lower bound

Measure the difficulty of a problem We can use the lower bound to measure the difficulty of a problem. With the lower bound, we can answer the questions: Is the algorithm for a problem the best (optimal)? Halting Problem Define a procedure halts? that takes a procedure and an input evaluates to #t if the procedure would terminate on that input, and to #f if would not terminate. (define (halts? procedure input) … ) Halting problem is undecidable (unsolvabel).

Lower bound The lower bound for a problem is not unique. e.g. (1), (n), (n log n) are all lower bounds for sorting. ((1), (n) are trivial) At present, if the highest lower bound of a problem is (n log n) and the time complexity of the best algorithm is O(n2). We may try to find a higher lower bound. We may try to find a better algorithm. Both of the lower bound and the algorithm may be improved. If the present lower bound is (n log n) for a problem and there is an algorithm with time complexity O(n log n), then the algorithm is optimal.

Asymptotic Notations Def: f(n) = O(g(n)) “upper bound" iff  c, n0  |f(n)|  c|g(n)|  n  n0 e.g. f(n) = 3n2 + 2 g(n) = n2  n0=2, c=4  f(n) = O(n2) e.g. f(n) = n3 + n = O(n3) e.g. f(n) = 3n2 + 2 = O(n3) or O(n100 )

asymptotic upper bound

Def : f(n) = (g(n)) “lower bound” iff  c, and n0,  |f(n)|  c|g(n)|  n  n0 e.g. f(n) = 3n2 + 2 = (n2) or  (n)

asymptotic lower bound

Def : f(n) = (g(n)) iff  c1, c2, and n0,  c1|g(n)|  |f(n)|  c2|g(n)|  n  n0 e. g. f(n) = 3n2 + 2 =  (n2)

f(n) = (g(n))

Theorem For any two functions f(n) and g(n), if and only if and .

The worst case lower bound of sorting 6 permutations for 3 data elements a1 a2 a3 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1

straight insertion sort: input data: (2, 3, 1) (1) a1:a2 (2) a2:a3, a2a3 (3) a1:a2, a1a2 input data: (2, 1, 3) (1)a1:a2, a1a2 (2)a2:a3

Decision tree for straight insertion sort:

Decision tree for bubble sort:

Worst case lower bound of sorting To find the worst case lower bound, we have to find the smallest depth of a binary tree. n! distinct permutations: n! leaf nodes in the binary decision tree. balanced tree has the smallest depth: log(n!) = (n log n) Worst case lower bound for sorting: (n log n)

log n!=O(n log n) Stirling approximation: n!  log n!  log  n log n  (n log n)

Average case lower bound of sorting A sorting algorithm corresponds to a binary decision tree. The average time complexity of a sorting algorithm: the external path length of the binary tree n! The external path length is minimized if the tree is balanced (all leaf nodes on level d or level d1)

Average case lower bound of sorting

Compute the min external path length 1. Depth of balanced binary tree with c leaf nodes: d = log c Leaf nodes can appear only on level d or d1. 2. x1 leaf nodes on level d1 x2 leaf nodes on level d x1 + x2 = c x1 + = 2d-1  x1 = 2d c x2 = 2(c  2d-1)

Average case lower bound of sorting 3. External path length: M= x1(d  1) + x2d = (2d  c)(d  1) + (2c  2d)d = c + cd  2d 4. d = log c  log c  d  log c + 1  c + cd  2d  c + c(log c) -2  2 log c = c log c – c. Thus M > c log c – c = n! log n! – n! M/n! > log n! -1 = (n log n) Average case lower bound of sorting: (n log n)

External Path Length of a tree The sum of the lengths of paths from the root to each of the leaf nodes.

Finding lower bound by problem transformation The lower bound of Problem A is known. Problem A reduces to problem B (AB) iff A can be solved by using any algorithm which solves B. Let ALGB be the algorithm with the lowest time complexity to solve the problem B, and let ALGA be the algorithm solving the problem A on the basis of ALGB. So, L(A) T(ALGA)  T(tr1) + T(tr2) + T(ALGB). If holds L(A) T(ALGA)  T(tr1) + T(tr2) + T(ALGB) = T(ALGB) if T(tr1) + T(tr2)  T(ALGA) If AB, B is more difficult. So, the lower bound of A is also the lower bound of B.

The lower bound of the convex hull problem sorting  convex hull A B an instance of A: (x1, x2,…, xn) ↓transformation an instance of B: {( x1, x12), ( x2, x22),…, ( xn, xn2)} assume: x1 < x2 < …< xn E. G. A: (2, 8, 3, 5)  B: {(2, 4), (8, 64), (3, 9), (5, 25)} The answer of B: {(2, 4), (3, 9), (5, 25), (8, 64)}  The answer of A: 2, 3, 5, 8

The lower bound of the convex hull problem If the convex hull problem can be solved, we can also solve the sorting problem. The lower bound of sorting: (n log n) Thus, the lower bound of the convex hull problem: (n log n)