Randomized Algorithms. IBM Almaden Research Center. San Jose, CA.

Similar documents
2.1 Complexity Classes

Full and Complete Binary Trees

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Mathematics for Algorithm and System Analysis

SIMS 255 Foundations of Software Design. Complexity and NP-completeness

Near Optimal Solutions

International Journal of Advanced Research in Computer Science and Software Engineering

Discuss the size of the instance for the minimum spanning tree problem.

GRAPH THEORY LECTURE 4: TREES

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) Total 92.

Approximation Algorithms

Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally

Lecture 13 - Basic Number Theory.

Introduction to Algorithms. Part 3: P, NP Hard Problems

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

Influences in low-degree polynomials

Answer Key for California State Standards: Algebra I

Algebra Unpacked Content For the new Common Core standards that will be effective in all North Carolina schools in the school year.

6.3 Conditional Probability and Independence

A Non-Linear Schema Theorem for Genetic Algorithms

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

Lecture 1: Course overview, circuits, and formulas

Analysis of Algorithms I: Binary Search Trees

Arrangements And Duality

CNFSAT: Predictive Models, Dimensional Reduction, and Phase Transition

Lecture 7: NP-Complete Problems

6.852: Distributed Algorithms Fall, Class 2

Exponential time algorithms for graph coloring

Dynamic Programming. Lecture Overview Introduction

Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1.

Symbol Tables. Introduction

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new GAP (2) Graph Accessibility Problem (GAP) (1)

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

Fast Sequential Summation Algorithms Using Augmented Data Structures

Elements of probability theory

Math 120 Final Exam Practice Problems, Form: A

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

INDISTINGUISHABILITY OF ABSOLUTELY CONTINUOUS AND SINGULAR DISTRIBUTIONS

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

How To Solve A K Path In Time (K)

1 Solving LPs: The Simplex Algorithm of George Dantzig

Math 55: Discrete Mathematics

Data Structures Fibonacci Heaps, Amortized Analysis

7 Gaussian Elimination and LU Factorization

Lecture 3: Finding integer solutions to systems of linear equations

Review of Fundamental Mathematics

Mathematical Induction. Lecture 10-11

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014

Microeconomics Sept. 16, 2010 NOTES ON CALCULUS AND UTILITY FUNCTIONS

Offline sorting buffers on Line

Solutions to Math 51 First Exam January 29, 2015

Adaptive Online Gradient Descent

HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!

Bits Superposition Quantum Parallelism

CMPSCI611: Approximating MAX-CUT Lecture 20

CS473 - Algorithms I

8.1 Min Degree Spanning Tree

(67902) Topics in Theory and Complexity Nov 2, Lecture 7

Classification/Decision Trees (II)

Nan Kong, Andrew J. Schaefer. Department of Industrial Engineering, Univeristy of Pittsburgh, PA 15261, USA

Binary Search Trees CMPSC 122

Lecture 18: Applications of Dynamic Programming Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY

Section IV.1: Recursive Algorithms and Recursion Trees

Regular Languages and Finite Automata

Mathematics Pre-Test Sample Questions A. { 11, 7} B. { 7,0,7} C. { 7, 7} D. { 11, 11}

2.1. Inductive Reasoning EXAMPLE A

Lecture 4 Online and streaming algorithms for clustering

Equations, Inequalities & Partial Fractions

From Last Time: Remove (Delete) Operation

Topology-based network security

Lecture 5 - CPA security, Pseudorandom functions

Master of Arts in Mathematics

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

PUTNAM TRAINING POLYNOMIALS. Exercises 1. Find a polynomial with integral coefficients whose zeros include

P versus NP, and More

Generating models of a matched formula with a polynomial delay

ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN. Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015

Solutions to Homework 6

Competitive Analysis of On line Randomized Call Control in Cellular Networks

LEARNING OBJECTIVES FOR THIS CHAPTER

IMPROVING PERFORMANCE OF RANDOMIZED SIGNATURE SORT USING HASHING AND BITWISE OPERATORS

Discrete Mathematics Problems


General Framework for an Iterative Solution of Ax b. Jacobi s Method

Linear Algebra: Vectors

Catalan Numbers. Thomas A. Dowling, Department of Mathematics, Ohio State Uni- versity.

Notes on Continuous Random Variables

Session 6 Number Theory

1 The Brownian bridge construction

1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

Lecture 6 Online and streaming algorithms for clustering

Optimal File Sharing in Distributed Networks

Solving Systems of Linear Equations

Decision Mathematics D1. Advanced/Advanced Subsidiary. Friday 12 January 2007 Morning Time: 1 hour 30 minutes. D1 answer book

How To Create A Tree From A Tree In Runtime (For A Tree)

Section 1.1. Introduction to R n

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Linear Programming for Optimization. Mark A. Schulze, Ph.D. Perceptive Scientific Instruments, Inc.

Transcription:

Randomized Algorithms Prabhakar Raghavan IBM Almaden Research Center San Jose, CA. {Typeset by FoilTEX {

Deterministic Algorithms INPUT ALGORITHM OUTPUT Goal: To prove that the algorithm solves the problem correctly (always) and quickly (typically, the number of steps should be polynomial in the size of the input). {Typeset by FoilTEX { 1

Randomized Algorithms INPUT ALGORITHM OUTPUT RANDOM NUMBERS In addition to input, algorithm takes a source of random numbers and makes random choices during execution. Behavior can vary even on a xed input. {Typeset by FoilTEX { 2

Randomized Algorithms INPUT ALGORITHM OUTPUT RANDOM NUMBERS Design algorithm + analysis to show that this behavior is likely to be good, on every input. (The likelihood is over the random numbers only.) {Typeset by FoilTEX { 3

Not to be confused with the Probabilistic Analysis of Algorithms RANDOM INPUT ALGORITHM OUTPUT DISTRIBUTION Here the input is assumed to be from a probability distribution. Show that the algorithm works for most inputs. {Typeset by FoilTEX { 4

Monte Carlo and Las Vegas A Monte Carlo algorithm runs for a xed number of steps, and produces an answer that is correct with probability 1=3. A Las Vegas algorithm always produces the correct answer its running time is a random variable whose expectation is bounded (say by a polynomial). {Typeset by FoilTEX { 5

Monte Carlo and Las Vegas These probabilities/expectations are only over the random choices made by the algorithm { independent of the input. Thus independent repetitions of Monte Carlo algorithms drive down the failure probability exponentially. {Typeset by FoilTEX { 6

Advantages of randomized algorithms Simplicity Performance For many problems, a randomized algorithm is the simplest, the fastest, or both. {Typeset by FoilTEX { 7

Scope Number-theoretic algorithms: Primality testing (Monte Carlo). Data structures: Sorting, order statistics, searching, computational geometry. Algebraic identities: Polynomial and matrix identity verication. Interactive proof systems. {Typeset by FoilTEX { 8

Mathematical programming: Faster algorithms for linear programming. Rounding linear program solutions to integer program solutions. Graph algorithms: Minimum spanning trees, shortest paths, minimum cuts. Counting and enumeration: Matrix permanent. Counting combinatorial structures. {Typeset by FoilTEX { 9

Parallel and distributed computing: Deadlock avoidance, distributed consensus. Probabilistic existence proofs: Show that a combinatorial object arises with non-zero probability among objects drawn from a suitable probability space. {Typeset by FoilTEX { 10

Derandomization: First devise a randomized algorithm, then argue that it can be \derandomized" to yield a deterministic algorithm. {Typeset by FoilTEX { 11

Game-tree evaluation 9 MAX 9 3 MIN MIN 7 9 3 17 MAX MAX MAX MAX 1 7 9 5 3 2 17 12 Tree with alternating MAX/MIN nodes. Each leaf has a real value. Goal: To evaluate the root. {Typeset by FoilTEX { 12

Game-tree evaluation 9 MAX 9 3 MIN MIN 7 9 3 17 MAX MAX MAX MAX 1 7 9 5 3 2 17 12 Cost: The number of leaves inspected. Algorithm: Computes leafinspection sequence. {Typeset by FoilTEX { 13

Simple special case Uniform binary tree, height h, with n = 2 h leaves. All values are boolean, so MAX!OR and MIN!AND. Exercise: Every deterministic algorithm can be forced to read n leaves. {Typeset by FoilTEX { 14

Randomized algorithm AND 1 0 OR OR 0 1 0 0 AND AND AND AND 1 0 1 1 1 0 1 0 Evaluate (recursively) a random child of the current node. If this does not determine the value of the current node, evaluate the other child. {Typeset by FoilTEX { 15

Analysis of tree evaluation AND-OR trees of depth 2k (k levels of AND and k levels of OR on any path) will prove by induction on k. Expected cost for an OR subtree evaluating to 1: 1 2 3k;1 + 1 2 2 3k;1 = 3 2 3k;1 : {Typeset by FoilTEX { 16

Analysis of tree evaluation For an OR subtree evaluating to 0, we must evaluate both of its subtrees, incurring cost 2(3 k;1 ). Now consider the root AND: (a) If it is 1, both OR subtrees must evaluate to 1 expected cost paid is twice above, = 3 k. (b) If it is 0, at least one OR subtree evaluates to 0. {Typeset by FoilTEX { 17

Game tree analysis Expected cost for root AND evaluating to 0: 2 3 k;1 + 1 2 3 2 3k;1 3 k : Number of leaves in tree = 4 k. Thus expected cost of randomized algorithm n 0:793 {Typeset by FoilTEX { 18

Lower bounds and the minimax principle Basic Idea: For a lower bound on the performance of all randomized algorithms for a problem, derive instead a lower bound for any deterministic algorithm for the problem when the inputs are drawn from a probability distribution (of your choice). {Typeset by FoilTEX { 19

Let I denote the set of instances of the problem, and A the set of deterministic algorithms for the problem. Any randomized algorithm can be viewed as a probability distribution on the algorithms in A. {Typeset by FoilTEX { 20

Minimax Principle For all distributions p over I and q over A, min A2A E[C(I p A)] max I2I E[C(I A q )]: {Typeset by FoilTEX { 21

Lower bound for game tree evaluation We will specify a probability distribution on instances (0=1 values for the leaves) and lower bound the expected running time of any deterministic algorithm. {Typeset by FoilTEX { 22

NOR trees instead Exercise: Showthat a balanced AND-OR tree of even depth is equivalent to a tree of the same depth, all of whose nodes are NOR nodes. We will show the lower bound for a NOR tree with n leaves. {Typeset by FoilTEX { 23

The input distribution Let p = (3 ; p 5)=2. Claim: The value of any node is 1 with probability p, independent of all other nodes at the same level. Claim: Any deterministic algorithm mayaswell determine the value of one sub-tree of a node, before inspecting any leaf of its sibling sub-tree. {Typeset by FoilTEX { 24

The Analysis Let W (h) be the expected number of leaves it inspects in determining the value of a node at distance h from the leaves. Clearly W (h) = W (h;1)+(1;p)w (h;1): Letting h = log 2 n, this gives a lower bound of n 0:694. {Typeset by FoilTEX { 25

Exercise: Why is this lower bound weak? {Typeset by FoilTEX { 26

The 2-SAT Problem Given a set of boolean clauses in CNF each containing two literals, nd a satisfying assignment if one exists. (x 1 + x 4 )(x 4 + x 3 )(x 2 + x 3 ) Start with any tentative assignment If there is an unsatised clause, pick one of its two literals at random, and ip it. {Typeset by FoilTEX { 27

If no solution found in 2n 2 steps, declare \none exists". Monte Carlo: If a solution exists, will nd it with probability > 1=2. If not, will always declare \none exists". {Typeset by FoilTEX { 28

Random Walk Analysis What is the probability of missing a satisfying assignment in 2n 2 steps? Fix any particular satisfying assignment A. Consider the numberof literals on which the algorithm's tentative assignment agrees with A. {Typeset by FoilTEX { 29

This is a random walk on the integers that increases with probability at least 1=2 at each step. Expected time to nd an assignment < n 2. Markov's inequality ) probability of missing an assignment in 2n 2 steps is < 1=2. {Typeset by FoilTEX { 30

Binary planar partitions L 1 s 1 L 2 L 1 L 2 L 3 s 3 s 2 s 1 s 3 s 3 s 2 L 3 Given n non-intersecting linesegments in the plane, build a small linear decision tree that has (pieces of) at most one segment in each cell. {Typeset by FoilTEX { 31

Autopartitions Choose the input segments in random order. Extend the chosen segment (if necessary) to cut any cells where it is not \alone". The expected size of the resulting tree is n + 2nH n. {Typeset by FoilTEX { 32

Analysis of autopartition size v 1 u v 2 Dene l(u) to be the line containing segment u. u a v denotes l(u) cuts v in the constructed tree. index(u v) is i if l(u) intersects i ; 1 other segments before hitting v. {Typeset by FoilTEX { 33

Autopartitions Pr[u a v] 1=(index(u v)+1): Thus the expected size of the tree constructed is +XX n +XX n u u v6=u v6=u Pr[u a v] 1 index(u v) + 1 {Typeset by FoilTEX { 34

For any u i, index(u v) = i for at most two v thus the above sum is n + 2nH n. It follows that for any n segments in the plane, there always exists an autopartition of size O(n log n). {Typeset by FoilTEX { 35

Matrix product verication Suppose A B and C are n n matrices with entries from a nite eld F. We wish to verify whether AB = C. Multiplying out takes about n 3 steps { this can be cut to O(n 2:38 ) steps using sophisticated algorithms. {Typeset by FoilTEX { 36

Simple randomized algorithm Pick an n-vector x with entries randomly drawn from F. Compute z = A(Bx). If z = Cx output AB = C, else output AB 6= C. Takes O(n 2 ) steps. {Typeset by FoilTEX { 37

Simple randomized algorithm If AB = C, will always output AB = C. If AB 6= C, will output C with probability at AB = most 1=jFj. {Typeset by FoilTEX { 38

Sources R.M. Karp. An introduction to randomized algorithms. Discrete Applied Mathematics, 34:165{ 201, 1991. R. Motwani and P. Raghavan. Randomized Algorithms. Cambridge University Press, 1995. D. J. A. Welsh. Randomised algorithms. Discrete Applied Mathematics, 5:133{145, 1983. {Typeset by FoilTEX { 39