Decision trees Polynomial-Time

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 )
Lower Bounds & Models of Computation Jeff Edmonds York University COSC 3101 Lecture 8.
© 2004 Goodrich, Tamassia Sorting Lower Bound1. © 2004 Goodrich, Tamassia Sorting Lower Bound2 Comparison-Based Sorting (§ 10.3) Many sorting 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.
Comp 122, Spring 2004 Lower Bounds & Sorting in Linear Time.
© 2004 Goodrich, Tamassia Sorting Lower Bound1. © 2004 Goodrich, Tamassia Sorting Lower Bound2 Comparison-Based Sorting (§ 10.3) Many sorting algorithms.
The Theory of NP-Completeness
CPSC 411, Fall 2008: Set 2 1 CPSC 411 Design and Analysis of Algorithms Set 2: Sorting Lower Bound Prof. Jennifer Welch Fall 2008.
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
Analysis of Algorithms CS 477/677
Chapter 11: Limitations of Algorithmic Power
Sorting Lower Bound Andreas Klappenecker based on slides by Prof. Welch 1.
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.
Sorting Lower Bound1. 2 Comparison-Based Sorting (§ 4.4) Many sorting algorithms are comparison based. They sort by making comparisons between pairs of.
MCS312: NP-completeness and Approximation Algorithms
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
The Lower Bounds of Problems
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.
Sorting Conclusions David Kauchak cs302 Spring 2013.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
1 Lower Bound on Comparison-based Search We have now covered lots of searching methods –Contiguous Data (Arrays) Sequential search Binary Search –Dynamic.
LIMITATIONS OF ALGORITHM POWER
CSCE 411H Design and Analysis of Algorithms Set 10: Lower Bounds Prof. Evdokia Nikolova* Spring 2013 CSCE 411H, Spring 2013: Set 10 1 * Slides adapted.
Linear Sorting. Comparison based sorting Any sorting algorithm which is based on comparing the input elements has a lower bound of Proof, since there.
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.
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
Introduction to NP Instructor: Neelima Gupta 1.
Lecture 5 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
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.
1 Section 5.1 Analyzing Algorithms Let P be a problem and A an algorithm to solve P. The running time of A can be analyzed by counting the number of certain.
Lower Bounds & Sorting in Linear Time
NP-Complete Problems.
P & NP.
David Kauchak cs062 Spring 2010
Sorting Lower Bound 4/25/2018 8:49 PM
EMIS 8373: Integer Programming
Advanced Algorithms Analysis and Design
Great Theoretical Ideas in Computer Science
CPSC 411 Design and Analysis of Algorithms
Trees.
CPSC 411 Design and Analysis of Algorithms
CSCE 411 Design and Analysis of Algorithms
Quick-Sort 11/14/2018 2:17 PM Chapter 4: Sorting    7 9
(2,4) Trees 11/15/2018 9:25 AM Sorting Lower Bound Sorting Lower Bound.
Lecture 5 Algorithm Analysis
Lower Bound Theory.
Quick-Sort 11/19/ :46 AM Chapter 4: Sorting    7 9
Ch8: Sorting in Linear Time Ming-Te Chi
Analysis and design of algorithm
CSCE 411 Design and Analysis of Algorithms
Lecture 5 Algorithm Analysis
(2,4) Trees 12/4/2018 1:20 PM Sorting Lower Bound Sorting Lower Bound.
CS200: Algorithm Analysis
Linear Sorting Sorting in O(n) Jeff Chastine.
Chapter 11 Limitations of Algorithm Power
Lower Bounds & Sorting in Linear Time
Quick-Sort 2/23/2019 1:48 AM Chapter 4: Sorting    7 9
Lecture 5 Algorithm Analysis
(2,4) Trees 2/28/2019 3:21 AM Sorting Lower Bound Sorting Lower Bound.
Lower bound for sorting, radix sort
CPSC 411 Design and Analysis of Algorithms
David Kauchak cs302 Spring 2012
CS 583 Analysis of Algorithms
Lecture 5 Algorithm Analysis
Presentation transcript:

Decision trees Polynomial-Time Lower Bounds Decision trees Polynomial-Time

Decision trees Some algorithms do not use the internal structure of their input data a1, …, an and can only compare them using <, >, or =. Any algorithm A which branches only on this information has as its execution model, for each n, a decision tree in which: Each internal node is a comparison (ai : aj), 1 ≤ i, j ≤ n. Each leaf is an outcome which answers the problem. For any particular input, execution of A corresponds to tracing a path from the root to a leaf (i.e. a branch, B) which takes time Ω(|B|). p. 340

Lower Bounds for Sorting Theorem: Any decision tree that correctly orders any n elements has height Ω(n log n) in the worst-case. Proof: A correct sorting algorithm yields a permutation π(1), …, π(n) for which aπ(1) ≤ … ≤ aπ(n). With distinct keys, every comparison yields at most one bit of information, so the branching factor is two. Since there are n! different arrangements of the input, the decision tree must have at least n! different outcomes (leaves). Any binary tree of height h has ≤ 2h leaves, so n! ≤ 2h, which means log2 n! ≤ h. Now since log2 n! = log2 n + … + log2 (n/2) + … > (n/2)(log2 n − 1), h is (n log n).

Lower Bounds for Searching Theorem: Any decision tree that finds a key a among n sorted elements has height Ω(log n) in the worst-case. Proof: A correct searching algorithm yields either a position 1 ≤ k ≤ n such that the a = ak, or else zero. So there must be more than n different outcomes (leaves in the decision tree). Every comparison with a has at most three possibilities (=, <, >), so the branching factor is three. Any ternary tree of height h has ≤ 3h leaves, so n < 3h, which means log3 n < h. Hence, h is (log n).

Polynomial-Time algorithms For an input of size n, a running time of O(nk) for some k. Decision problems: executing algorithm YES instance of problem binary encoding machine NO abstract model By asking for individual bits in the output, we can convert any polytime algorithm with output to a polytime decision problem. Def: Let P = the class of all decision problems solvable in polynomial time. 11.3

Polynomial-Time Verification Example: A Hamiltonian cycle of an undirected graph G = V, E is a simple cycle (of edges) containing each vertex (once). Problem: Does G have a Hamiltonian cycle? Verification: () certificate YES verifier G NO Yet, a purported Hamiltonian cycle can be verified in P. 11.3

Polynomial-Time Verification Def: Let NP = the class of decision problems than can be verified in P. Consider a polytime preducate A(x, y): L  NP  L = {x  {0, 1}* : y A(x, y) = YES} L  co-NP  L = {x  {0, 1}* : y A(x, y) = YES}  L = {x  {0, 1}* : y A(x, y) = NO} dicuss the psychology of creating vs. verifying ideas (proofs) co-NP NP P 11.3