Sublinear Time Algorithms Oct 19, Lecture 1

Similar documents
Yao s Minimax Principle

Lecture l(x) 1. (1) x X

Essays on Some Combinatorial Optimization Problems with Interval Data

ECON 459 Game Theory. Lecture Notes Auctions. Luca Anderlini Spring 2017

AVL Trees. The height of the left subtree can differ from the height of the right subtree by at most 1.

Lecture 2: The Simple Story of 2-SAT

1 Solutions to Tute09

CS599: Algorithm Design in Strategic Settings Fall 2012 Lecture 6: Prior-Free Single-Parameter Mechanism Design (Continued)

On the Optimality of a Family of Binary Trees Techical Report TR

CSE 21 Winter 2016 Homework 6 Due: Wednesday, May 11, 2016 at 11:59pm. Instructions

Lecture 4: Divide and Conquer

CSCE 750, Fall 2009 Quizzes with Answers

Maximum Contiguous Subsequences

TABLEAU-BASED DECISION PROCEDURES FOR HYBRID LOGIC

CEC login. Student Details Name SOLUTIONS

Mechanism Design and Auctions

Optimal Satisficing Tree Searches

Tug of War Game. William Gasarch and Nick Sovich and Paul Zimand. October 6, Abstract

Martingale Pricing Theory in Discrete-Time and Discrete-Space Models

Notes on the EM Algorithm Michael Collins, September 24th 2005

Lecture 23: April 10

THE TRAVELING SALESMAN PROBLEM FOR MOVING POINTS ON A LINE

Fibonacci Heaps Y Y o o u u c c an an s s u u b b m miitt P P ro ro b blle e m m S S et et 3 3 iin n t t h h e e b b o o x x u u p p fro fro n n tt..

Lecture 6. 1 Polynomial-time algorithms for the global min-cut problem

Lecture 7: Bayesian approach to MAB - Gittins index

Max Registers, Counters and Monotone Circuits

Smoothed Analysis of Binary Search Trees

Q1. [?? pts] Search Traces

4 Martingales in Discrete-Time

Heaps. Heap/Priority queue. Binomial heaps: Advanced Algorithmics (4AP) Heaps Binary heap. Binomial heap. Jaak Vilo 2009 Spring

Global Joint Distribution Factorizes into Local Marginal Distributions on Tree-Structured Graphs

A relation on 132-avoiding permutation patterns

SET 1C Binary Trees. 2. (i) Define the height of a binary tree or subtree and also define a height balanced (AVL) tree. (2)

Decidability and Recursive Languages

Heaps

PARELLIZATION OF DIJKSTRA S ALGORITHM: COMPARISON OF VARIOUS PRIORITY QUEUES

LECTURE 2: MULTIPERIOD MODELS AND TREES

Lecture 11: Bandits with Knapsacks

Two-Dimensional Bayesian Persuasion

16 MAKING SIMPLE DECISIONS

The Probabilistic Method - Probabilistic Techniques. Lecture 7: Martingales

Rational Behaviour and Strategy Construction in Infinite Multiplayer Games

Outline Introduction Game Representations Reductions Solution Concepts. Game Theory. Enrico Franchi. May 19, 2010

Levin Reduction and Parsimonious Reductions

Outline for this Week

UNIT 2. Greedy Method GENERAL METHOD

Maximizing the Spread of Influence through a Social Network Problem/Motivation: Suppose we want to market a product or promote an idea or behavior in

CMPSCI 311: Introduction to Algorithms Second Midterm Practice Exam SOLUTIONS

Homework #4. CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class

Issues. Senate (Total = 100) Senate Group 1 Y Y N N Y 32 Senate Group 2 Y Y D N D 16 Senate Group 3 N N Y Y Y 30 Senate Group 4 D Y N D Y 22

Finding Roots by "Closed" Methods

Introduction to Greedy Algorithms: Huffman Codes

Advanced Algorithmics (4AP) Heaps

Probability. An intro for calculus students P= Figure 1: A normal integral

Design and Analysis of Algorithms 演算法設計與分析. Lecture 9 November 19, 2014 洪國寶

NOTES ON FIBONACCI TREES AND THEIR OPTIMALITY* YASUICHI HORIBE INTRODUCTION 1. FIBONACCI TREES

Outline. Objective. Previous Results Our Results Discussion Current Research. 1 Motivation. 2 Model. 3 Results

6.854J / J Advanced Algorithms Fall 2008

Design and Analysis of Algorithms. Lecture 9 November 20, 2013 洪國寶

ECE 586GT: Problem Set 1: Problems and Solutions Analysis of static games

Lecture 14: Basic Fixpoint Theorems (cont.)

Lecture 10: The knapsack problem

MA300.2 Game Theory 2005, LSE

Variations on a theme by Weetman

Lecture 5: Tuesday, January 27, Peterson s Algorithm satisfies the No Starvation property (Theorem 1)

Lecture 5. 1 Online Learning. 1.1 Learning Setup (Perspective of Universe) CSCI699: Topics in Learning & Game Theory

15-451/651: Design & Analysis of Algorithms October 23, 2018 Lecture #16: Online Algorithms last changed: October 22, 2018

Lecture 17: More on Markov Decision Processes. Reinforcement learning

You Have an NP-Complete Problem (for Your Thesis)

Bounds on coloring numbers

IEOR E4004: Introduction to OR: Deterministic Models

MAT 4250: Lecture 1 Eric Chung

Lecture 5: Iterative Combinatorial Auctions

The Complexity of Simple and Optimal Deterministic Mechanisms for an Additive Buyer. Xi Chen, George Matikas, Dimitris Paparas, Mihalis Yannakakis

Computing Unsatisfiable k-sat Instances with Few Occurrences per Variable

Chapter 2 Uncertainty Analysis and Sampling Techniques

MAT25 LECTURE 10 NOTES. = a b. > 0, there exists N N such that if n N, then a n a < ɛ

Lecture 2: Making Good Sequences of Decisions Given a Model of World. CS234: RL Emma Brunskill Winter 2018

Advanced Operations Research Prof. G. Srinivasan Dept of Management Studies Indian Institute of Technology, Madras

Outline for Today. Quick refresher on binomial heaps and lazy binomial heaps. An important operation in many graph algorithms.

The Real Numbers. Here we show one way to explicitly construct the real numbers R. First we need a definition.

Successor. CS 361, Lecture 19. Tree-Successor. Outline

Forecast Horizons for Production Planning with Stochastic Demand

Enforcing monotonicity of decision models: algorithm and performance

Data Structures. Binomial Heaps Fibonacci Heaps. Haim Kaplan & Uri Zwick December 2013

Optimal selling rules for repeated transactions.

Priority Queues 9/10. Binary heaps Leftist heaps Binomial heaps Fibonacci heaps

Recitation 1. Solving Recurrences. 1.1 Announcements. Welcome to 15210!

DRAFT. 1 exercise in state (S, t), π(s, t) = 0 do not exercise in state (S, t) Review of the Risk Neutral Stock Dynamics

Monte Carlo and Empirical Methods for Stochastic Inference (MASM11/FMSN50)

Realizability of n-vertex Graphs with Prescribed Vertex Connectivity, Edge Connectivity, Minimum Degree, and Maximum Degree

Online Algorithms SS 2013

Structural Induction

Single Price Mechanisms for Revenue Maximization in Unlimited Supply Combinatorial Auctions

COSC 311: ALGORITHMS HW4: NETWORK FLOW

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Bargaining and Competition Revisited Takashi Kunimoto and Roberto Serrano

Revenue optimization in AdExchange against strategic advertisers

Crash-tolerant Consensus in Directed Graph Revisited

Fundamental Algorithms - Surprise Test

Transcription:

0368.416701 Sublinear Time Algorithms Oct 19, 2009 Lecturer: Ronitt Rubinfeld Lecture 1 Scribe: Daniel Shahaf 1 Sublinear-time algorithms: motivation Twenty years ago, there was practically no investigation of sublinear-time algorithms. One reason for this was that it wasn t that common to have extremely large datasets. Today, however, datasets of many different types may be so large that a linear-time algorithm would take ridiculously long. At other times, time constraints require us to make a decision too swiftly than to allow for examining the input in its entirety. 1 In first part of the course we will model the input as written down somewhere such that we have query access to (i.e., for any i we can query for the ith bit of the input). Towards the end of the course, we will consider a different model where our inputs consists of samples taken from an unknown distribution. Running in sublinear-time precludes us from reading the entire input; therefore, we will typically use sampling. Though sometimes we will use straightforward sampling, many of our algorithms will use more intricate algorithmic techniques combined with sampling. Being sublinear-time will, in most cases, force us to use randomness in our algorithms and limit us to only hope for an approximate answer (in many cases getting a non-approximate answer requires reading the input fully). The next example is the only deterministic algorithm we will see in this course. 2 Examples 2.1 A deterministic algorithm Example 1: point-set diameter Given An m m distance matrix d. We assume the matrix is symmetric and satisfies the triangle inequality. Goal Compute the diameter ˆd def = max u,v d(u, v). Algorithm Analysis Pick an arbitrary point x. Find the point y farthest from x. Output z def = d(x, y). Claim 2 The algorithm s time complexity is sublinear. The algorithm s time complexity is O(m), i.e., O( input size). 1 Another reason for interest is the human quality of laziness: a quick answer that requires neither reading much input nor much computations appeals to many. 1

Claim 3 The algorithm is a (multiplicative) 2-approximation algorithm for the diameter problem; that is, ˆd/2 z ˆd. The right inequality is trivial. We show the left one. Fix two points a, b such that the diameter is ˆd = d(a, b). Then ˆd = d(a, b) d(a, x) + d(x, b) d(x, a) + d(x, b) d(x, y) + d(x, y) = 2z. 2.2 A decision problem As we mentioned before, most sublinear algorithms must output some sort of approximation. In this example, we discuss a type of approximation that makes sense for outputs of decision problems. Example 4: sequence monotonicity, attempt 1 Given An ordered list X 1,..., X n of elements (with partial order on them). Goal Is the list monotone? That is, is X 1 X n? As stated, the goal requires looking at every single sequence element. (If we skip over even one of them, that one may be the only one breaking the monotonicity.) Therefore we relax the problem: Example 5: sequence monotonicity, attempt 2 Given An ordered list X 1,..., X n of elements (with partial order on them) and a real fraction ɛ [0, 1]. Goal Is the list close to monotone? (We will say that a list is ɛ-close to monotone if it has a monotone subsequence of length (1 ɛ)n.) Required behavior We require a 2-sided (BPP) error: If the list is monotone, the test should pass with probability 3/4. If the list is ɛ-far from monotone, the test should fail with probability 3/4. Remark The choice of 3/4 is arbitrary; any constant bounded away from 1/2 works equally well. We can amplify the definition from our constant to a different constant 1 β by repeating our algorithm O(log 1 β ) times and taking the majority answer. Remark The behavior of the test on inputs that are very close to monotone, but are not monotone, is undefined. (Those inputs are ɛ -close with 0 ɛ ɛ.) This makes sense because those inputs are almost monotone so we allow ourselves the latitude to treat them as if they were monotone while, all in all, they are not monotone, and declaring them as such is correct. Here are a few algorithmic ideas that one might try to base a tester upon: 2

Idea 6: Pick i < j randomly and test x i < x j. We will show that this idea s complexity is Ω( n). Fix some constant c, and consider the following sequence: c, c 1,..., 1, 2c, 2c 1,..., c + 1,...,...,..., n, n 1,..., n c + 1 }{{}}{{}}{{}. The longest monotone subsequence has length n/c (we can t pick twice from the same group since each group is monotonically decreasing) relatively small, so we would like this sequence to fail the test. We can see, however, that the test passes whenever it picks i, j from different groups. The following can be shown: If the test is repeated by repeatedly picking new pairs i, j, each time discarding the old pair, and checking each such pair independently of the others, then Ω(n) pairs are needed. However, if the test is repeated by picking k indices and checking whether the subsequence induced by them is monotone, then Θ( n/c) samples are needed (using the Birthday Paradox). We will see that we can do much better. Idea 7: Pick i randomly and test x i x i+1. Fix some constant c, and consider the following sequence (of n elements): 1, 2,..., n/c, 1, 2,..., n/c,..., 1, 2,..., n/c }{{}}{{}}{{}. Again, the longest monotone subsequence has length c + n c 1 relatively small, so we would like this sequence to fail the test. However, the test passes unless the i it picks is a border point (i.e., unless X i = n/c), which happens with probability c/n. Therefore we expect to require a linear number of samples before detecting an input that should be rejected. Idea 8: Combine the previous two ideas. This would verify that the sequence is locally monotone, and also monotone at large distances, but would not verify that it is monotone in middle-range gaps. And counter-examples can be found. However, there exists a correct, O(log n)-samples algorithms that works by testing pairs at various distances 1, 2, 4, 8,..., 2 k,..., n/2. Before giving an algorithm, we make the following assumption. Assumption 9 X i are pairwise distinct. Mentally replace each X i by the tuple (X i, i) and use dictionary order: to compare (X i, i) to (X j, j), compare the first coordinate and use the second coordinate to break ties. Remark This trick does not hamper the sublinearity of the algorithm because it does not require any pre-processing; the transformation can be done on the fly as each element is accessed and compared. Notation [n] denotes the set {1, 2,..., n} of positive integers. R denotes assignment of a random member of the set on its RHS to the variable on its LHS. If the distribution is not specified, it is the uniform distribution. For example, x R [3] assigns to x one of the three smallest positive integers, chosen uniformly. 3

Algorithm Repeat O(1/ɛ) times: Pick i R [n]. Query (obtain) the value X i. Do binary search for X i. If either an inconsistency was found during the binary search; X i was not found; then return fail. Return pass. Inconsistency By an inconsistency we mean the following: during the binary search, we maintain an interval of allowed values for the next value we query. The interval starts as [, + ]. Its upper and lower bounds are updated whenever we take a step to the left (towards smaller elements) or to the right (towards larger elements), respectively. Whenever we query a value we assert that it is in the interval and raise an inconsistency if it isn t. Time complexity This algorithm s time complexity is O( 1 ɛ log n), since the augmented binary search and the choosing of a random index cost O(log n) steps each; and those are repeated O(1/ɛ) times. Correctness We will now show that the algorithm satisfies the required behavior. We will define which indices are good and relate the number of bad indices to the length of a monotone sequence of elements at good indices. Definition 10 An index i is good if augmented binary search for i is successful (does not detect an inconsistency). Observation 11 If ɛn indices are bad, then Prob [pass] < 1/4. Let c be the constant under the O(1/ɛ) repetitions clause. Then Prob [pass] (1 ɛ) c/ɛ (1/ɛ) c < 1 4, (1) where the last (strict) inequality follows by setting c to a large enough (constant) value. Theorem 12 The above algorithm has 2-sided error less than one quarter: it accepts good inputs with probability 1 and rejects bad inputs with probability at least 3/4. If the list is monotone, then it passes with certainty because the binary search works and the X i are assumed distinct. It remains to prove that far-from-monotone lists are rejected with high likelihood. We prove the contrapositive: assuming that an input passes with probability > 1/4, we will show that it is ɛ-close. Let X 1,..., X n be accepted with probability > 1/4. By equation (1), the number of bad indices is < ɛn. Therefore (1 ɛ)n indices are good. 4

Claim 13 If we delete all elements at bad indices, the remaining sequence is monotone. Let i < j be two good indices. Consider the paths in the binary-search tree from the root to i and to j. These two paths have some longest prefix common to both of them. It suffices to show that x i z x j. There are two cases. If the path to x i is a prefix of the path to x j, then x i = z (they are the same node in the tree). Otherwise x i is a descendant of a z s left or right child. Since i is good, then x i must be a descendant of z s left child; for the same reason x i must be smaller than z. Therefore, x i z always. By symmetry, z x j. Therefore x i x j. The theorem follows from the claim. Remark It is known that Ω ( (log n)/ɛ ) samples is optimal. 2.3 Another example Example 14: graph connectivity, attempt 1 Given A graph G = (V, E) with n = V vertices and m = E edges having maximum degree at most d (we think of d as a large constant). The graph is represented as an adjacency list. Goal Is the graph connected? As before, answering this question with no error requires examining the entire graph: an example is the line graph L n (i.e., a cycle with one edge removed). Therefore, we will have to compromise on the goal if we are limited to sublinear time. Example 15: graph connectivity, attempt 2 Given A graph G = (V, E) with n = V vertices and m = E edges having maximum degree at most d (we think of d as a large constant). The graph is represented as an adjacency list. Goal Is the graph close to connected? We will say that a graph is ɛ-close to connected if it can be transformed into a connected graph by adding at most ɛdn edges. (An alternative definition exists, which allows adding or removing up to ɛdn edges, but on the other hand requires the resulting graph to still have maximum degree at most d. For simplicity we will use the addition-only definition given in the previous paragraph.) Required behavior We require a 1-sided error: If the graph is connected, the test should pass with probability 1. If the graph is ɛ-far from connected, the test should fail with probability 3/4. Idea If a graph is ɛ-far from connected it has many ( ɛn) connected components many connected components are small many nodes are in small connected components. 5

Algorithm 1. Choose O(1/ɛd) nodes. 2. For each node s of these, run a BFS 2 (originating from it) until either: (a) 2/ɛd distinct nodes are discovered; (b) s is determined to belong to a connected component of size 2/ɛd nodes. 3. If 2b ever happens, reject G and halt. 4. Otherwise, accept. Time complexity The number of loops is O(1/ɛd). Each BFS costs up to O(2/ɛd) steps. During the BFS, neighbor determination at each node is done by iterating its adjacency list, which can have length up to d. Therefore the time complexity is O ( 1 ɛd 2 ɛd d) = O(1/dɛ 2 ). Lemma 16 If G is ɛ-far from connected, then G has ɛdn connected components. N connected components can be connected by adding N 1 edges. Remark This proof is trickier if we use the alternative (max-degree-respecting) definition of ɛ-far. Corollary 17 If G is ɛ-far from connected, then it has ɛdn/2 connected components of size less than 2/ɛd. Since G is ɛ-far, it has L > ɛdn connected components. Let l be the number of connected components of size < 2/ɛd and l be the number of connected components of size 2/ɛd. So l + l = L. Therefore, l + l ɛdn (using the lemma). Also l 2 ɛd n (the LHS is the number of vertices in the connected components counted by l), i.e., l ɛdn/2. The conclusion, l ɛdn/2, follows by combining the last two inequalities. Corollary 18 The fraction of nodes in V belonging to connected components smaller than 2/ɛd is at least ɛd/2. For vertex u V, let C(u) denote the connected component of u and let S(u) be the event that C(u) < 2/ɛd. Then {u V : S(u)} {C(u) : u V S(u)} Prob [S(u)] = ɛdn/2 = ɛd u RV V V n 2. Intuitively, this bounds the number of nodes in small connected components from below by the number of such connected components. Theorem 19 The test passes connected graphs with certainty and fails ɛ-far graphs with probability at least 3/4. that The first claim is obvious (step 2b will never occur). We show the second claim. We see ( Prob [fail] 1 Prob [pass] 1 1 ɛd ) O(1/ɛd) 1 e c 3 2 4. where the last inequality follows from choosing the constant c such that e c < 1/4. 2 breadth-first search 6