Lecture 5. The Incompressibility Method  A key problem in computer science: analyze the average case performance of a program.  Using the Incompressibility.

Slides:



Advertisements
Similar presentations
Theory of Computing Lecture 23 MAS 714 Hartmut Klauck.
Advertisements

QuickSort Average Case Analysis An Incompressibility Approach Brendan Lucier August 2, 2005.
Theory of Computing Lecture 3 MAS 714 Hartmut Klauck.
Lecture 12: Lower bounds By "lower bounds" here we mean a lower bound on the complexity of a problem, not an algorithm. Basically we need to prove that.
CSC 2300 Data Structures & Algorithms March 16, 2007 Chapter 7. Sorting.
Deterministic Selection and Sorting Prepared by John Reif, Ph.D. Analysis of Algorithms.
Computational Complexity 1. Time Complexity 2. Space Complexity.
The number of edge-disjoint transitive triples in a tournament.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture13: Mapping Reductions Prof. Amos Israeli.
Chapter 3 Growth of Functions
Comp 122, Spring 2004 Elementary Sorting Algorithms.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata are like Turing Machines with a restriction: The working space of the tape is the space of the.
CSC 2300 Data Structures & Algorithms March 27, 2007 Chapter 7. Sorting.
Randomized Algorithms and Randomized Rounding Lecture 21: April 13 G n 2 leaves
Sorting. Introduction Assumptions –Sorting an array of integers –Entire sort can be done in main memory Straightforward algorithms are O(N 2 ) More complex.
Lecture 5: Master Theorem and Linear Time Sorting
Data Structures Review Session 1
CSE 326: Data Structures Sorting Ben Lerner Summer 2007.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
DAST 2005 Week 4 – Some Helpful Material Randomized Quick Sort & Lower bound & General remarks…
The Complexity of Algorithms and the Lower Bounds of Problems
Chapter 7 (Part 2) Sorting Algorithms Merge Sort.
1 Non-regular languages. 2 Regular languages Non-regular languages.
CS 202, Spring 2003 Fundamental Structures of Computer Science II Bilkent University1 Sorting CS 202 – Fundamental Structures of Computer Science II Bilkent.
Sorting Lower Bound1. 2 Comparison-Based Sorting (§ 4.4) Many sorting algorithms are comparison based. They sort by making comparisons between pairs of.
Great Theoretical Ideas in Computer Science.
© Neeraj Suri EU-NSF ICT March 2006 Dependable Embedded Systems & SW Group Prof. Neeraj Suri Dan Dobre Overview: 1.Merge.
Sorting in Linear Time Lower bound for comparison-based sorting
CSE 373 Data Structures Lecture 15
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:
Kolmogorov complexity and its applications Ming Li School of Computer Science University of Waterloo CS 898.
Mathematics Review and Asymptotic Notation
The Growth of Functions Rosen 2.2 Basic Rules of Logarithms log z (xy) log z (x/y) log z (x y ) If x = y If x < y log z (-|x|) is undefined = log z (x)
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
Order Statistics The ith order statistic in a set of n elements is the ith smallest element The minimum is thus the 1st order statistic The maximum is.
Jessie Zhao Course page: 1.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
Elementary Sorting Algorithms Many of the slides are from Prof. Plaisted’s resources at University of North Carolina at Chapel Hill.
1 Chapter 7: Sorting (Insertion Sort, Shellsort) CE 221 Data Structures and Algorithms Izmir University of Economics Text: Read Weiss, § 7.1 – 7.4.
Fall 2015 Lecture 4: Sorting in linear time
Lecture 5. The Incompressibility Method  A key problem in computer science: analyze the average case performance of a program.  Using the Incompressibility.
Chapter 7: Sorting Algorithms Insertion Sort. Sorting Algorithms  Insertion Sort  Shell Sort  Heap Sort  Merge Sort  Quick Sort 2.
Kolmogorov complexity and its applications Ming Li School of Computer Science University of Waterloo CS860,
Lecture 5-1. The Incompressibility Method, continued  We give a few more examples using the incompressibility method. We avoid ones with difficult and.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part 1. Complexity Bounds.
1/6/20161 CS 3343: Analysis of Algorithms Lecture 2: Asymptotic Notations.
Quick sort, lower bound on sorting, bucket sort, radix sort, comparison of algorithms, code, … Sorting: part 2.
E.G.M. PetrakisAlgorithm Analysis1  Algorithms that are equally correct can vary in their utilization of computational resources  time and memory  a.
Sorting Fundamental Data Structures and Algorithms Aleks Nanevski February 17, 2004.
Lecture 5. The Incompressibility Method  A key problem in computer science: analyze the average case performance of a program.  Using the Incompressibility.
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.
Fundamental Structures of Computer Science February 20, 2003 Ananda Guna Introduction to Sorting.
Sorting & Lower Bounds Jeff Edmonds York University COSC 3101 Lecture 5.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
Fundamental Data Structures and Algorithms
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
The Incompressibility Method using Kolmogorov Complexity
Lecture 5. The Incompressibility Method
CS 3343: Analysis of Algorithms
Lecture 6. Prefix Complexity K
Sorting We have actually seen already two efficient ways to sort:
Lecture 5-1. The Incompressibility Method, continued
Data Structures Review Session
CS154, Lecture 12: Time Complexity
CSE 373 Sorting 2: Selection, Insertion, Shell Sort
Sorting We have actually seen already two efficient ways to sort:
Presentation transcript:

Lecture 5. The Incompressibility Method  A key problem in computer science: analyze the average case performance of a program.  Using the Incompressibility Method:  Give the program a random input (with high Kolmogorov complexity)  Analyze the program with respect to this single and fixed input. This is usually easier using the fact this input is incompressible.  The running time for this single input is the average case running time of all inputs!

Example: Show L={0 k 1 k | k>0} not regular. By contradiction, assume that DFA M accepts L. Choose k so that C(k) >> 2|M|. Simulate M: 000 … … 1 C(k) < |M| + q + O(1) < 2|M|. Contradiction. Remark. Generalize to iff condition: more powerful & easier to use than “pumping lemmas”. kk M q stop here Formal language theory

Combinatorics Example There is a tournament (complete directed graph) T of n players that contains no large transitive subtournaments (>1 + 2 log n). Proof by Picture: Choose a random T. One bit codes an edge. C(T)  n(n-1)/2. If there is a large transitive subtournament, then a large number of edges are given for free! C(T)< n(n  1)/2  subgraph-edges  overhead T Linearly ordered subgraph. Easy to describe

Fast adder Example. Fast addition on average. Ripple-carry adder: n steps adding n-bit numbers. Carry-lookahead adder: 2 log n steps. Burks-Goldstine-von Neumann (1946): logn expected steps. S= x  y; C= carry sequence; while (C≠0) { S= S  C; C= new carry sequence; } Average case analysis: Fix x, take random y s.t. C(y|x)≥|y| x = … u1 … ( Max such u is carry length) y = … û1 …, û is complement of u If |u| > log n, then C(y|x)<|y|. Average over all y, get logn. QED

Sorting  Given n elements (in an array). Sort them into ascending order.  This is the most studied fundamental problem in computer science.  Shellsort (1959): P passes. In each pass, move the elements “in some stepwise fashion” (Bubblesort)  Open for over 40 years: a nontrivial general average case complexity lower bound of Shellsort?

Shellsort Algorithm Using p increments h 1, …, h p, with h p =1 At k-th pass, the array is divided in h k separate sublists of length n/h k (taking every h k -th element). Each sublist is sorted by insertion/bubble sort Application: Sorting networks --- nlog 2 n comparators.

Shellsort history Invented by D.L. Shell [1959], using p k = n/2 k for step k. It is a Θ(n 2 ) time algorithm Papernow&Stasevitch [1965]: O(n 3/2 ) time. Pratt [1972]: O(nlog 2 n) time. Incerpi-Sedgewick, Chazelle, Plaxton, Poonen, Suel (1980’s) – worst case, roughly,Θ(nlog 2 n / (log logn) 2 ). Average case: Knuth [1970’s]: Θ(n 5/3 ) for p=2 Yao [1980]: p=3 Janson-Knuth [1997]: Ω(n 23/15 ) for p=3. Jiang-Li-Vitanyi [J.ACM, 2000]: Ω(pn 1+1/p ) for any p.

Shellsort Average Case Lower bound Theorem. p-pass Shellsort average case T(n) ≥ pn 1+1/p Proof. Fix a random permutation Π with Kolmogorov complexity nlogn. I.e. C(Π)≥ nlogn. Use Π as input. For pass i, let m i,k be the number of steps the kth element moves. Then T(n) = Σ i,k m i,k From these m i,k 's, one can reconstruct the input Π, hence Σ log m i,k ≥ C(Π) ≥ n logn Maximizing the left, all m i,k must be the same. Call it m. Σ log m i,k = pn logm ≥ nlogn  m p ≥ n. So T(n) = pnm > pn 1+1/p. ■ Corollary: p=1: Bubblesort Ω(n 2 ) average case lower bound. p=2: n 1.5 lower bound. p=3, n 4/3 lower bound

Heapsort 1964, JWJ Williams [CACM 7(1964), ] first published Heapsort algorithm Immediately it was improved by RW Floyd. Worst case O(nlogn). Open for 40 years: Which is better in average case: Williams or Floyd? R. Schaffer & Sedgewick (1996). Ian Munro provided solution here.

Heapsort average analysis (I. Munro) Average-case analysis of Heapsort. Heapsort: (1) Make Heap. O(n) time. (2) Deletemin, restore heap, repeat. d d log n WilliamsFloyd 2 log n - 2dlog n + d Fix random heap H, C(H) > n log n. Simulate Step (2). Each round, encode the red path in log n -d bits. The n paths describe the heap! Hence, total n paths, length  n log n, d must be a constant. Floyd takes n log n comparisons, and Williams takes 2n log n. comparisons/round

A selected list of results proved by the incompressibility method Ω (n 2 ) for simulating 2 tapes by 1 (20 years) k heads > k-1 heads for PDAs (15 years) k one-ways heads can’t do string matching (13 yrs) 2 heads are better than 2 tapes (10 years) Average case analysis for heapsort (30 years) k tapes are better than k-1 tapes. (20 years) Many theorems in combinatorics, formal language/automata, parallel computing, VLSI Simplify old proofs (Hastad Lemma). Shellsort average case lower bound (40 years)

More on formal language theory Lemma (Li-Vitanyi) Let L  V *, and L x ={y: xy  L}. Then L is regular implies there is c for all x,y,n, let y be the n-th element in L x, we have C(y) ≤ C(n)+c. Proof. Like example. QED. Example 2. {1 p : p is prime} is not regular. Proof. Let p i, i=1,2 …, be the list of primes. Then p k+1 is the first element in L Pk, hence by Lemma, C(p k+1 )≤O(1). Impossible. QED

Characterizing regular sets For any enumeration of  *={y 1,y 2, …}, define characteristic sequence of L x ={y i : xy i  L} by X i = 1 iff xy i  L Theorem. L is regular iff there is a c for all x,n, C(X n |n) < c