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

Lower Bounds for Sorting, Searching and Selection
Analysis of Algorithms CS 477/677 Linear Sorting Instructor: George Bebis ( Chapter 8 )
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.
Deterministic Selection and Sorting Prepared by John Reif, Ph.D. Analysis of Algorithms.
Lecture 5: Linear Time Sorting Shang-Hua Teng. Sorting Input: Array A[1...n], of elements in arbitrary order; array size n Output: Array A[1...n] of the.
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.
CSC 2300 Data Structures & Algorithms March 27, 2007 Chapter 7. Sorting.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
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,
Chapter 11: Limitations of Algorithmic Power
CSE 326: Data Structures Sorting Ben Lerner Summer 2007.
DAST 2005 Week 4 – Some Helpful Material Randomized Quick Sort & Lower bound & General remarks…
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
The Complexity of Algorithms and the Lower Bounds of Problems
CSE 373 Data Structures Lecture 15
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
2 -1 Chapter 2 The Complexity of Algorithms and the Lower Bounds of Problems.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
1 Chapter 1 Analysis Basics. 2 Chapter Outline What is analysis? What to count and consider Mathematical background Rates of growth Tournament method.
CSCE350 Algorithms and Data Structure Lecture 17 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
Instructor Neelima Gupta Table of Contents Review of Lower Bounding Techniques Decision Trees Linear Sorting Selection Problems.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
Foundation of Computing Systems
LIMITATIONS OF ALGORITHM POWER
Sorting 1. Insertion Sort
1 CSC 421: Algorithm Design & Analysis Spring 2014 Complexity & lower bounds  brute force  decision trees  adversary arguments  problem reduction.
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 
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
© 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.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
CSE 589 Applied Algorithms Spring 1999 Prim’s Algorithm for MST Load Balance Spanning Tree Hamiltonian Path.
Sorting and Runtime Complexity CS255. Sorting Different ways to sort: –Bubble –Exchange –Insertion –Merge –Quick –more…
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.
David Kauchak cs062 Spring 2010
Sorting Lower Bound 4/25/2018 8:49 PM
Decision trees Polynomial-Time
Trees.
CPSC 411 Design and Analysis of Algorithms
CSCE 411 Design and Analysis of Algorithms
(2,4) Trees 11/15/2018 9:25 AM Sorting Lower Bound Sorting Lower Bound.
Lower Bound Theory.
The Complexity of Algorithms and the Lower Bounds of Problems
CSCE 411 Design and Analysis of Algorithms
(2,4) Trees 12/4/2018 1:20 PM Sorting Lower Bound Sorting Lower Bound.
CS200: Algorithm Analysis
Chapter 11 Limitations of Algorithm Power
Data Structures Sorting Haim Kaplan & Uri Zwick December 2014.
The Lower Bounds of Problems
(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
CPSC 411 Design and Analysis of 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.
David Kauchak cs302 Spring 2012
CS 583 Analysis of Algorithms
Presentation transcript:

The Lower Bounds of Problems

Measure the difficulty of a problem NP-complete ? Undecidable ? Is the algorithm for a problem the best ? optimal (algorithm) 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 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

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) and there is an algorithm with time complexity O(n log n), then the algorithm is optimal.

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:

Lower bound of sorting To find the 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) 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 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)

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. Note: It is required that T(tr1) + T(tr2) < T(ALGB) So, L(A) T(ALGA)  T(tr1) + T(tr2) + T(ALGB) = T(ALGB) 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)

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