4.4 The recursion-tree method
|
|
- Gabriel McKinney
- 7 years ago
- Views:
Transcription
1 4.4 The recursion-tree method Let us see how a recursion tree would provide a good guess for the recurrence = 3 4 ) Start by nding an upper bound Floors and ceilings usually do not matter when solving recurrences Create a recursion tree for the recurrence = 3 4 having written out the implied constant coefcient > 0 MAT AADS, Fall Sep MAT AADS, Fall Sep
2 MAT AADS, Fall Sep Subproblem sizes decrease by a factor of 4 each time we go down one level => we eventually must reach a boundary condition Subproblem size for a node at depth is /4 It hits =1when /4 = 1or, equivalently, when = log Thus, the tree has log +1levels (at depths 0, 1, 2,, log ) MAT AADS, Fall Sep
3 Each level has 3 the nodes of level above the number of nodes at depth is 3 Subproblem sizes reduce by a factor of 4 for each level we go down, each node at depth, = 0,1,2,,log 1, has cost of 4 Multiplying, we see that the total cost over all nodes at depth is 3 4 ) = (3 16) The bottom level, at depth log, has 3 = nodes, each contributing cost (1), for a total cost of (1), which is ), since (1) is a constant ) MAT AADS, Fall Sep Add up the costs over all levels to determine the cost for the entire tree: 3 = ) 16 (3 16 = ) 1 (3 ) 16)1 By the value of a geometric (or exponential) series = 1 1 MAT AADS, Fall Sep
4 We can use an innite decreasing geometric series as an upper bound = 3 16 ) = (3 16) = ) MAT AADS, Fall Sep We have derived a guess of for our recurrence = 3 4 ) Root of the tree contributes to the total cost a constant fraction of the total cost The cost of the root dominates the total cost If is indeed an upper bound for the recurrence, then it must be a tight bound First recursive call contributes cost of ), must be a lower bound for the recurrence MAT AADS, Fall Sep
5 Use the substitution method to verify that the guess was correct, i.e., is an upper bound for the recurrence We want to show that for some constant >0 = ) = 3 16 as long as (16 13) MAT AADS, Fall Sep A more intricate example is the recurrence ) = /3) + (2/3) + ) represents the constant in the term Adding the values across the levels of the recursion tree yields value for every level The longest simple path from the root to a leaf is (23 (2 3) 1 (2 3) = 1when = log The height of the tree is log MAT AADS, Fall Sep
6 MAT AADS, Fall Sep We expect the solution to the recurrence to be number of levels cost of each level: log ) = lg ) Not every level contributes a cost of If this recursion tree were a complete binary tree of height log, there would be leaves 2 The cost of each leaf is a constant The total cost of all leaves would then be ) which, since log 2>1, is ( lg ) MAT AADS, Fall Sep
7 This recursion tree is not a complete binary tree, however, and has fewer than leaves As we go down from the root, more and more internal nodes are absent Consequently, levels toward the bottom contribute less than to the total cost we can use the substitution method to verify that lgis an upper bound for the solution to the recurrence MAT AADS, Fall Sep The master method Theorem 4.1 (Master theorem) Let and > 1,and ) a function, ) is dened on nonneg. integers by recurrence )+, where we means either or. ) has the following asymptotic bounds: MAT AADS, Fall Sep
8 1. If = ( ) for some constant > 0, then )= 2. If )=, then )= lg 3. If )= for some constant >0, and if ) ) for some constant <1 and all sufciently large, then ) = ) MAT AADS, Fall Sep In each of the three cases, we compare the function ) with the function The larger of the two determines the solution to the recurrence In case 1, the function is the larger, then the solution is )= In case 3, the function ) is the larger, then the solution is ) = In case 2, the two functions are the same size, we multiply by a logarithmic factor, and the solution is )= lg MAT AADS, Fall Sep
9 Be aware of some technicalities: In case 1, not only must ) be smaller than, it must be polynomially smaller ) must be asymptotically smaller than by a factor of for some >0 In case 3, not only must ) be larger than, it also must be polynomially larger and satisfy the regularity condition that () () MAT AADS, Fall Sep Using the master method ) = 93) We have =9,=3,)=, and thus ) Since ) = ), where =1, we can apply case 1 of the master theorem and conclude that the solution is ) MAT AADS, Fall Sep
10 ) = (2 3) +1 Here =1, = 3 2, )=1, and =1 Case 2 applies, since = (1), and thus the solution to the recurrence is (lg ) MAT AADS, Fall Sep () = ( 4) + lg We have =3,=4, lg, and ) Since ) = ), where 0.2, case 3 applies provided that the regularity condition holds for ) For sufciently large, we have that )= 3(4) lg(4) (34) lg = ) for = 34 By case 3, the solution is lg ) MAT AADS, Fall Sep
11 The master method does not apply to ) = 22) lg even if it seems to have the proper form: =2,=2, lg, and One might think that case 3 applies, since is asymptotically larger than It is, however, not polynomially larger: ratio = lg is asymptotically less than for any positive constant Consequently, the recurrence falls into the gap between case 2 and case 3 MAT AADS, Fall Sep The recurrence of the running time of the simple divide-and-conquer algorithm for matrix multiplication ) = 82) ) Now =8,=2, and and so Since is polynomially larger than i.e., for =1 case 1 applies, and () = MAT AADS, Fall Sep
12 The recurrence of the running time of Strassen s algorithm ) = 72) ) Here we have =7,=2, and and so Recalling that 2.80 < lg7 < 2.81, we see that = O( ) for = 0.8 Again, case 1 applies, and we have the solution () = MAT AADS, Fall Sep Probabilistic Analysis and Randomized Algorithms We need to hire a new ofce assistant with the help of an employment agency that sends us a candidate each day We interview that person and then decide either to hire her or not We pay the agency a fee for each interview To actually hire an applicant is more costly We must re the current ofce assistant and pay a substantial hiring fee to the agency MAT AADS, Fall Sep
13 5.1 The hiring problem We are committed to having, at all times, the best possible person for the job After interviewing an applicant, if she is better qualied than the current assistant, we will re the current ofce assistant and hire the new applicant We are willing to pay the price of this strategy, but wish to estimate what that price will be MAT AADS, Fall Sep HIRE-ASSISTANT) 1. best 0 // candidate 0 is a leastqualied dummy candidate 2. for 1to 3. interview candidate 4. if candidate is better than best 5. best 6. hire candidate MAT AADS, Fall Sep
14 Interviewing has a low cost,, whereas hiring is expensive, costing Letting be the number of people hired, the total cost of the algorithm is ) No matter how many people we hire, we always interview candidates and thus always incur the cost Let us concentrate on analyzing, the hiring cost This quantity varies with each run of the algorithm MAT AADS, Fall Sep Worst-case analysis In the worst case, we hire every candidate that we interview candidates come in increasing order of quality we hire times, for a total hiring cost of We have no idea about the order in which the candidates arrive, nor do we have any control over this order It is natural to ask what we expect to happen in a typical or average case MAT AADS, Fall Sep
15 Probabilistic analysis We can assume that the applicants come in a random order Assume that we can compare any two candidates and decide the better qualied there is a total order on the candidates Rank each candidate with a unique number 1,, Use ) to denote the rank of applicant MAT AADS, Fall Sep A higher rank corresponds to a better qualied applicant Ordered list 1, 2,, ) is a permutation of the list 1,2,, The applicants come in a random order this list of ranks is equally likely to be any one of the! permutations of the numbers 1 through Alternatively, the ranks form a uniform random permutation; i.e., each of the possible! permutations appears with equal probability MAT AADS, Fall Sep
16 Randomized algorithms We call an algorithm randomized if its behavior is determined also by values produced by a random-number generator RANDOM A call to RANDOM returns an integer between and, inclusive, with each such integer being equally likely E.g., RANDOM(0,1) produces 0 with probability 1, 2and 1 with probability 12 MAT AADS, Fall Sep A call to RANDOM 3,7 returns either 3,4,5,6,7, each with probability 15 Each integer returned by RANDOM is independent of the integers returned on previous calls In analyzing the running time of a randomized algorithm, we take the expectation of the running time over the distribution of values returned by the RANDOM We refer to the running time of a randomized algorithm as an expected running time MAT AADS, Fall Sep
17 5.2 Indicator random variables Indicator random variables provide a convenient method for converting between probabilities and expectations Suppose we are given a sample space and an event Then the indicator random variable } associated with is dened as 1 ifoccurs 0 ifdoesnotoccur MAT AADS, Fall Sep Let us determine the expected number of heads that we obtain when ipping a fair coin Our sample space is = { }, with Pr = Pr = 12 We dene an indicator random variable, associated with the coin coming up heads () This variable counts the number of heads obtained in this ip = 1 ifhoccurs 0 iftoccurs MAT AADS, Fall Sep
18 Recall that E = Pr } The expected number of heads obtained in one ip of the coin is simply the expected value of our indicator variable E =E = 1 Pr +0Pr = 1 (12) + 0 (12) = 12 Thus the expected number of heads obtained by one ip of a fair coin is 12 MAT AADS, Fall Sep The expected value of an indicator random variable associated with an event is equal to the probability that occurs Lemma 5.1 Given a sample space and an event in, let }. Then E = Pr{} Proof By the denition of an indicator and the denition of expected value, we have = = 1 Pr + 0 Pr = Pr, where denotes, the complement of MAT AADS, Fall Sep
19 Compute the number of heads in coin ips Let be the indicator associated with the event in which the th ip comes up heads: {thethflipresultsintheevent} Let denote the total number of heads in the coin ips, so that = To compute the expected number of heads, take the expectation of both sides to obtain E =E MAT AADS, Fall Sep Linearity of expectation E =E +E makes the use of indicator random variables a powerful analytical technique it applies even when there is dependence among the variables We now can easily compute the expected number of heads: E =E = E 12 = 2 MAT AADS, Fall Sep
20 Analysis of the hiring problem Let be the random variable whose value number of times we hire a new assistant let be the indicator random variable associated with the event in which the th candidate is hired candidateishired = 1 ifcandidateishired 0 ifcandidateisnothired MAT AADS, Fall Sep By Lemma 5.1 E = Pr candidateishired and we must compute the probability that lines 5 6 of HIRE-ASSISTANT are executed Candidate is hired (line 6) exactly when she is better than each of candidates 1,, We assume that the candidates arrive in a random order: the rst candidates have appeared in a random order Any one of these rst candidates is equally likely to be the best-qualied so far MAT AADS, Fall Sep
21 Candidate has a probability of 1/ of being better qualied than candidates 1,,1and thus a probability of 1/ of being hired. By Lemma 5.1, we conclude that E Now we can compute E : E =E = E = = ln (1) by harmonic series = = ln (1) = 1/ MAT AADS, Fall Sep We interview people, but actually hire only approx. ln of them, on average The following lemma summarize this Lemma 5.2 Assuming that candidates come in random order, algorithm HIRE-ASSISTANT has an average-case total hiring cost of ln ) Proof Follows immediately from our denition of the hiring cost and the equation, which shows that the expected number of hires is approximately ln MAT AADS, Fall Sep
22 5.3 Randomized algorithms The algorithm above is deterministic The number of times we hire a new ofce assistant differs for different inputs Given the rank list = 1,2,3,4,5,6,7,8,9,10, a new assistant is always hired 10 times For the list of ranks = 10,9,8,7,6,5,4,3,2,1, a new assistant is hired only once = 5,2,1,8,4,7,10,9,3,6, a new assistant is hired three times MAT AADS, Fall Sep Consider an algorithm that rst permutes the input before determining the best candidate Now we randomize in the algorithm, not in the input distribution For input we cannot say how many times the best is updated it differs with each run Not even an enemy can produce a bad input, random permutation yields input order irrelevant The algorithm performs badly only if the randomnumber generator produces an unlucky permutation MAT AADS, Fall Sep
23 RANDOMIZED-HIRE-ASSISTANT) 1. randomly permute the list of candidates 2. best 0 // candidate 0 is a least-qualied // dummy candidate 3. for 1to 4. interview candidate 5. if candidate is better than candidate best 6. best 7. hire candidate MAT AADS, Fall Sep Randomly permuting arrays We assume that we are given an array which, w.l.o.g., contains the elements 1,2,, Produce a random permutation of the array Assign element ] a random priority ], and sort the elements according to priorities E.g., if our initial array is = 1,2,3,4 and we choose random priorities = 36,3,62,19, we would produce array = 2,4,1,3 We call this procedure PERMUTE-BY-SORTING MAT AADS, Fall Sep
24 PERMUTE-BY-SORTING) 1.. length 2. let [1..]be a new array 3. for 1to 4. RANDOM(1, ) 5. sort, using as sort keys We use a range of 1 to for random numbers to make it likely that all the priorities in are unique MAT AADS, Fall Sep It remains to prove that the procedure produces a uniform random permutation, It is equally likely to produce every permutation of the numbers 1 through Lemma 5.4 PERMUTE-BY-SORTING produces a uniform random permutation of the input, assuming that all priorities are distinct Proof See the book. MAT AADS, Fall Sep
25 It is better to permute the given array in place RANDOMIZE-IN-PLACE does so in ) time In its th iteration, it chooses the element ] randomly from among elements through ] After the th iteration, is never altered RANDOMIZE-IN-PLACE) 1 2 for 1to 3 swap with [RANDOM(, )] MAT AADS, Fall Sep A -permutation on a set of elements is a sequence containing of the elements, with no repetitions There are!! -permutations loop invariant: Just prior to the th iteration of the for loop of lines 2 3, for each possible 1)-permutation of the elements, the subarray [1.. 1] contains this 1)-permutation with probability +1!! MAT AADS, Fall Sep
26 Initialization: loop invariant trivially holds Maintenance: Consider a particular -permutation, and denote the elements in it by,, This permutation consists of an 1)- permutation,, followed by the value that the algorithm places in ] Let denote the event in which the rst 1) iterations have created the particular 1)- permutation,, in [1.. 1] MAT AADS, Fall Sep By the loop invariant, Pr = + 1!! Let be the event that th iteration puts in position ] The -permutation,, appears in 1.. precisely when both and occur Pr Pr Pr{ Pr =1 +1 because in line 3 the algorithm chooses randomly from the +1values in positions.. Pr = ! =!!! MAT AADS, Fall Sep
27 Termination: At termination, +1, and we have that the subarray 1.. is a given -permutation with probability !! = 0!! = 1! Thus, RANDOMIZE-IN-PLACE produces a uniform random permutation MAT AADS, Fall Sep
Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally
Recurrence Relations Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally modeled by recurrence relations. A recurrence relation is an equation which
More informationLecture 1: Course overview, circuits, and formulas
Lecture 1: Course overview, circuits, and formulas Topics in Complexity Theory and Pseudorandomness (Spring 2013) Rutgers University Swastik Kopparty Scribes: John Kim, Ben Lund 1 Course Information Swastik
More informationIntroduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1.
Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Quiz 1 Quiz 1 Do not open this quiz booklet until you are directed
More informationHOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!
Math 7 Fall 205 HOMEWORK 5 SOLUTIONS Problem. 2008 B2 Let F 0 x = ln x. For n 0 and x > 0, let F n+ x = 0 F ntdt. Evaluate n!f n lim n ln n. By directly computing F n x for small n s, we obtain the following
More informationOutline BST Operations Worst case Average case Balancing AVL Red-black B-trees. Binary Search Trees. Lecturer: Georgy Gimel farb
Binary Search Trees Lecturer: Georgy Gimel farb COMPSCI 220 Algorithms and Data Structures 1 / 27 1 Properties of Binary Search Trees 2 Basic BST operations The worst-case time complexity of BST operations
More information14.1 Rent-or-buy problem
CS787: Advanced Algorithms Lecture 14: Online algorithms We now shift focus to a different kind of algorithmic problem where we need to perform some optimization without knowing the input in advance. Algorithms
More informationConverting a Number from Decimal to Binary
Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive
More informationLecture 3: Finding integer solutions to systems of linear equations
Lecture 3: Finding integer solutions to systems of linear equations Algorithmic Number Theory (Fall 2014) Rutgers University Swastik Kopparty Scribe: Abhishek Bhrushundi 1 Overview The goal of this lecture
More informationApproximation Algorithms
Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms
More informationAnalysis of Algorithms I: Binary Search Trees
Analysis of Algorithms I: Binary Search Trees Xi Chen Columbia University Hash table: A data structure that maintains a subset of keys from a universe set U = {0, 1,..., p 1} and supports all three dictionary
More informationA Note on Maximum Independent Sets in Rectangle Intersection Graphs
A Note on Maximum Independent Sets in Rectangle Intersection Graphs Timothy M. Chan School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1, Canada tmchan@uwaterloo.ca September 12,
More informationFaster deterministic integer factorisation
David Harvey (joint work with Edgar Costa, NYU) University of New South Wales 25th October 2011 The obvious mathematical breakthrough would be the development of an easy way to factor large prime numbers
More informationData Structures Fibonacci Heaps, Amortized Analysis
Chapter 4 Data Structures Fibonacci Heaps, Amortized Analysis Algorithm Theory WS 2012/13 Fabian Kuhn Fibonacci Heaps Lacy merge variant of binomial heaps: Do not merge trees as long as possible Structure:
More informationThe Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)!
The Tower of Hanoi Recursion Solution recursion recursion recursion Recursive Thinking: ignore everything but the bottom disk. 1 2 Recursive Function Time Complexity Hanoi (n, src, dest, temp): If (n >
More informationGRAPH THEORY LECTURE 4: TREES
GRAPH THEORY LECTURE 4: TREES Abstract. 3.1 presents some standard characterizations and properties of trees. 3.2 presents several different types of trees. 3.7 develops a counting method based on a bijection
More informationMATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.
MATH10212 Linear Algebra Textbook: D. Poole, Linear Algebra: A Modern Introduction. Thompson, 2006. ISBN 0-534-40596-7. Systems of Linear Equations Definition. An n-dimensional vector is a row or a column
More information9.2 Summation Notation
9. Summation Notation 66 9. Summation Notation In the previous section, we introduced sequences and now we shall present notation and theorems concerning the sum of terms of a sequence. We begin with a
More informationLecture 5 - CPA security, Pseudorandom functions
Lecture 5 - CPA security, Pseudorandom functions Boaz Barak October 2, 2007 Reading Pages 82 93 and 221 225 of KL (sections 3.5, 3.6.1, 3.6.2 and 6.5). See also Goldreich (Vol I) for proof of PRF construction.
More informationWhy? A central concept in Computer Science. Algorithms are ubiquitous.
Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online
More informationZeros of a Polynomial Function
Zeros of a Polynomial Function An important consequence of the Factor Theorem is that finding the zeros of a polynomial is really the same thing as factoring it into linear factors. In this section we
More informationLecture 13 - Basic Number Theory.
Lecture 13 - Basic Number Theory. Boaz Barak March 22, 2010 Divisibility and primes Unless mentioned otherwise throughout this lecture all numbers are non-negative integers. We say that A divides B, denoted
More informationAnalysis of Algorithms I: Optimal Binary Search Trees
Analysis of Algorithms I: Optimal Binary Search Trees Xi Chen Columbia University Given a set of n keys K = {k 1,..., k n } in sorted order: k 1 < k 2 < < k n we wish to build an optimal binary search
More informationLecture 13: Factoring Integers
CS 880: Quantum Information Processing 0/4/0 Lecture 3: Factoring Integers Instructor: Dieter van Melkebeek Scribe: Mark Wellons In this lecture, we review order finding and use this to develop a method
More informationRecursive Algorithms. Recursion. Motivating Example Factorial Recall the factorial function. { 1 if n = 1 n! = n (n 1)! if n > 1
Recursion Slides by Christopher M Bourke Instructor: Berthe Y Choueiry Fall 007 Computer Science & Engineering 35 Introduction to Discrete Mathematics Sections 71-7 of Rosen cse35@cseunledu Recursive Algorithms
More informationThe Goldberg Rao Algorithm for the Maximum Flow Problem
The Goldberg Rao Algorithm for the Maximum Flow Problem COS 528 class notes October 18, 2006 Scribe: Dávid Papp Main idea: use of the blocking flow paradigm to achieve essentially O(min{m 2/3, n 1/2 }
More informationFull and Complete Binary Trees
Full and Complete Binary Trees Binary Tree Theorems 1 Here are two important types of binary trees. Note that the definitions, while similar, are logically independent. Definition: a binary tree T is full
More informationCSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Today Registration should be done. Homework 1 due 11:59 pm next Wednesday, January 14 Review math essential
More informationSequential Data Structures
Sequential Data Structures In this lecture we introduce the basic data structures for storing sequences of objects. These data structures are based on arrays and linked lists, which you met in first year
More information1 Introduction to Internet Content Distribution
OS 521: Advanced Algorithm Design Hashing / ontent Distribution 02/09/12 Scribe: Shilpa Nadimpalli Professor: Sanjeev Arora 1 Introduction to Internet ontent Distribution 1.1 The Hot-Spot Problem 1 ertain
More informationBinary Heaps * * * * * * * / / \ / \ / \ / \ / \ * * * * * * * * * * * / / \ / \ / / \ / \ * * * * * * * * * *
Binary Heaps A binary heap is another data structure. It implements a priority queue. Priority Queue has the following operations: isempty add (with priority) remove (highest priority) peek (at highest
More information7 Gaussian Elimination and LU Factorization
7 Gaussian Elimination and LU Factorization In this final section on matrix factorization methods for solving Ax = b we want to take a closer look at Gaussian elimination (probably the best known method
More informationSorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)
Sorting revisited How did we use a binary search tree to sort an array of elements? Tree Sort Algorithm Given: An array of elements to sort 1. Build a binary search tree out of the elements 2. Traverse
More information1.2 Solving a System of Linear Equations
1.. SOLVING A SYSTEM OF LINEAR EQUATIONS 1. Solving a System of Linear Equations 1..1 Simple Systems - Basic De nitions As noticed above, the general form of a linear system of m equations in n variables
More informationRandomized algorithms
Randomized algorithms March 10, 2005 1 What are randomized algorithms? Algorithms which use random numbers to make decisions during the executions of the algorithm. Why would we want to do this?? Deterministic
More information1/1 7/4 2/2 12/7 10/30 12/25
Binary Heaps A binary heap is dened to be a binary tree with a key in each node such that: 1. All leaves are on, at most, two adjacent levels. 2. All leaves on the lowest level occur to the left, and all
More informationHow Asymmetry Helps Load Balancing
How Asymmetry Helps oad Balancing Berthold Vöcking nternational Computer Science nstitute Berkeley, CA 947041198 voecking@icsiberkeleyedu Abstract This paper deals with balls and bins processes related
More informationPractical Guide to the Simplex Method of Linear Programming
Practical Guide to the Simplex Method of Linear Programming Marcel Oliver Revised: April, 0 The basic steps of the simplex algorithm Step : Write the linear programming problem in standard form Linear
More informationBinary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child
Binary Search Trees Data in each node Larger than the data in its left child Smaller than the data in its right child FIGURE 11-6 Arbitrary binary tree FIGURE 11-7 Binary search tree Data Structures Using
More informationLecture 22: November 10
CS271 Randomness & Computation Fall 2011 Lecture 22: November 10 Lecturer: Alistair Sinclair Based on scribe notes by Rafael Frongillo Disclaimer: These notes have not been subjected to the usual scrutiny
More informationOffline sorting buffers on Line
Offline sorting buffers on Line Rohit Khandekar 1 and Vinayaka Pandit 2 1 University of Waterloo, ON, Canada. email: rkhandekar@gmail.com 2 IBM India Research Lab, New Delhi. email: pvinayak@in.ibm.com
More information! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.
Approximation Algorithms Chapter Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of
More informationby the matrix A results in a vector which is a reflection of the given
Eigenvalues & Eigenvectors Example Suppose Then So, geometrically, multiplying a vector in by the matrix A results in a vector which is a reflection of the given vector about the y-axis We observe that
More information8.1 Min Degree Spanning Tree
CS880: Approximations Algorithms Scribe: Siddharth Barman Lecturer: Shuchi Chawla Topic: Min Degree Spanning Tree Date: 02/15/07 In this lecture we give a local search based algorithm for the Min Degree
More informationCS473 - Algorithms I
CS473 - Algorithms I Lecture 4 The Divide-and-Conquer Design Paradigm View in slide-show mode 1 Reminder: Merge Sort Input array A sort this half sort this half Divide Conquer merge two sorted halves Combine
More informationLecture Notes on Binary Search Trees
Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 17 October 23, 2014 1 Introduction In this lecture, we will continue considering associative
More informationU.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009. Notes on Algebra
U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009 Notes on Algebra These notes contain as little theory as possible, and most results are stated without proof. Any introductory
More informationGuessing Game: NP-Complete?
Guessing Game: NP-Complete? 1. LONGEST-PATH: Given a graph G = (V, E), does there exists a simple path of length at least k edges? YES 2. SHORTEST-PATH: Given a graph G = (V, E), does there exists a simple
More informationLecture 2: Universality
CS 710: Complexity Theory 1/21/2010 Lecture 2: Universality Instructor: Dieter van Melkebeek Scribe: Tyson Williams In this lecture, we introduce the notion of a universal machine, develop efficient universal
More informationCost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:
CSE341T 08/31/2015 Lecture 3 Cost Model: Work, Span and Parallelism In this lecture, we will look at how one analyze a parallel program written using Cilk Plus. When we analyze the cost of an algorithm
More informationNear Optimal Solutions
Near Optimal Solutions Many important optimization problems are lacking efficient solutions. NP-Complete problems unlikely to have polynomial time solutions. Good heuristics important for such problems.
More informationLecture 10 Union-Find The union-nd data structure is motivated by Kruskal's minimum spanning tree algorithm (Algorithm 2.6), in which we needed two operations on disjoint sets of vertices: determine whether
More informationLecture 6 Online and streaming algorithms for clustering
CSE 291: Unsupervised learning Spring 2008 Lecture 6 Online and streaming algorithms for clustering 6.1 On-line k-clustering To the extent that clustering takes place in the brain, it happens in an on-line
More informationMath 55: Discrete Mathematics
Math 55: Discrete Mathematics UC Berkeley, Spring 2012 Homework # 9, due Wednesday, April 11 8.1.5 How many ways are there to pay a bill of 17 pesos using a currency with coins of values of 1 peso, 2 pesos,
More informationCS473 - Algorithms I
CS473 - Algorithms I Lecture 9 Sorting in Linear Time View in slide-show mode 1 How Fast Can We Sort? The algorithms we have seen so far: Based on comparison of elements We only care about the relative
More informationA Branch and Bound Algorithm for Solving the Binary Bi-level Linear Programming Problem
A Branch and Bound Algorithm for Solving the Binary Bi-level Linear Programming Problem John Karlof and Peter Hocking Mathematics and Statistics Department University of North Carolina Wilmington Wilmington,
More informationLecture Notes on Binary Search Trees
Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning Lecture 17 March 17, 2010 1 Introduction In the previous two lectures we have seen how to exploit the structure
More informationarxiv:1112.0829v1 [math.pr] 5 Dec 2011
How Not to Win a Million Dollars: A Counterexample to a Conjecture of L. Breiman Thomas P. Hayes arxiv:1112.0829v1 [math.pr] 5 Dec 2011 Abstract Consider a gambling game in which we are allowed to repeatedly
More information1 Solving LPs: The Simplex Algorithm of George Dantzig
Solving LPs: The Simplex Algorithm of George Dantzig. Simplex Pivoting: Dictionary Format We illustrate a general solution procedure, called the simplex algorithm, by implementing it on a very simple example.
More informationCHAPTER 2 Estimating Probabilities
CHAPTER 2 Estimating Probabilities Machine Learning Copyright c 2016. Tom M. Mitchell. All rights reserved. *DRAFT OF January 24, 2016* *PLEASE DO NOT DISTRIBUTE WITHOUT AUTHOR S PERMISSION* This is a
More informationLecture 4 Online and streaming algorithms for clustering
CSE 291: Geometric algorithms Spring 2013 Lecture 4 Online and streaming algorithms for clustering 4.1 On-line k-clustering To the extent that clustering takes place in the brain, it happens in an on-line
More informationCOMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012
Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about
More information17.3.1 Follow the Perturbed Leader
CS787: Advanced Algorithms Topic: Online Learning Presenters: David He, Chris Hopman 17.3.1 Follow the Perturbed Leader 17.3.1.1 Prediction Problem Recall the prediction problem that we discussed in class.
More informationa 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2.
Chapter 1 LINEAR EQUATIONS 1.1 Introduction to linear equations A linear equation in n unknowns x 1, x,, x n is an equation of the form a 1 x 1 + a x + + a n x n = b, where a 1, a,..., a n, b are given
More informationSMT 2014 Algebra Test Solutions February 15, 2014
1. Alice and Bob are painting a house. If Alice and Bob do not take any breaks, they will finish painting the house in 20 hours. If, however, Bob stops painting once the house is half-finished, then the
More informationChapter 11. 11.1 Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling
Approximation Algorithms Chapter Approximation Algorithms Q. Suppose I need to solve an NP-hard problem. What should I do? A. Theory says you're unlikely to find a poly-time algorithm. Must sacrifice one
More informationThe `Russian Roulette' problem: a probabilistic variant of the Josephus Problem
The `Russian Roulette' problem: a probabilistic variant of the Josephus Problem Joshua Brulé 2013 May 2 1 Introduction The classic Josephus problem describes n people arranged in a circle, such that every
More informationLecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs
CSE599s: Extremal Combinatorics November 21, 2011 Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs Lecturer: Anup Rao 1 An Arithmetic Circuit Lower Bound An arithmetic circuit is just like
More informationFrom Last Time: Remove (Delete) Operation
CSE 32 Lecture : More on Search Trees Today s Topics: Lazy Operations Run Time Analysis of Binary Search Tree Operations Balanced Search Trees AVL Trees and Rotations Covered in Chapter of the text From
More informationInformation Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay
Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 17 Shannon-Fano-Elias Coding and Introduction to Arithmetic Coding
More informationBinary Search Trees CMPSC 122
Binary Search Trees CMPSC 122 Note: This notes packet has significant overlap with the first set of trees notes I do in CMPSC 360, but goes into much greater depth on turning BSTs into pseudocode than
More informationData Structures and Algorithms
Data Structures and Algorithms Computational Complexity Escola Politècnica Superior d Alcoi Universitat Politècnica de València Contents Introduction Resources consumptions: spatial and temporal cost Costs
More informationAPP INVENTOR. Test Review
APP INVENTOR Test Review Main Concepts App Inventor Lists Creating Random Numbers Variables Searching and Sorting Data Linear Search Binary Search Selection Sort Quick Sort Abstraction Modulus Division
More information1 Approximating Set Cover
CS 05: Algorithms (Grad) Feb 2-24, 2005 Approximating Set Cover. Definition An Instance (X, F ) of the set-covering problem consists of a finite set X and a family F of subset of X, such that every elemennt
More informationONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN. Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015
ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015 ONLINE STEINER FOREST PROBLEM An initially given graph G. s 1 s 2 A sequence of demands (s i, t i ) arriving
More informationThe Online Set Cover Problem
The Online Set Cover Problem Noga Alon Baruch Awerbuch Yossi Azar Niv Buchbinder Joseph Seffi Naor ABSTRACT Let X = {, 2,..., n} be a ground set of n elements, and let S be a family of subsets of X, S
More information1. (First passage/hitting times/gambler s ruin problem:) Suppose that X has a discrete state space and let i be a fixed state. Let
Copyright c 2009 by Karl Sigman 1 Stopping Times 1.1 Stopping Times: Definition Given a stochastic process X = {X n : n 0}, a random time τ is a discrete random variable on the same probability space as
More informationThe Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,
The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, cheapest first, we had to determine whether its two endpoints
More information6.3 Conditional Probability and Independence
222 CHAPTER 6. PROBABILITY 6.3 Conditional Probability and Independence Conditional Probability Two cubical dice each have a triangle painted on one side, a circle painted on two sides and a square painted
More informationFind-The-Number. 1 Find-The-Number With Comps
Find-The-Number 1 Find-The-Number With Comps Consider the following two-person game, which we call Find-The-Number with Comps. Player A (for answerer) has a number x between 1 and 1000. Player Q (for questioner)
More informationData Structure [Question Bank]
Unit I (Analysis of Algorithms) 1. What are algorithms and how they are useful? 2. Describe the factor on best algorithms depends on? 3. Differentiate: Correct & Incorrect Algorithms? 4. Write short note:
More informationLecture Notes on Linear Search
Lecture Notes on Linear Search 15-122: Principles of Imperative Computation Frank Pfenning Lecture 5 January 29, 2013 1 Introduction One of the fundamental and recurring problems in computer science is
More informationCSE 135: Introduction to Theory of Computation Decidability and Recognizability
CSE 135: Introduction to Theory of Computation Decidability and Recognizability Sungjin Im University of California, Merced 04-28, 30-2014 High-Level Descriptions of Computation Instead of giving a Turing
More informationSOLVING POLYNOMIAL EQUATIONS
C SOLVING POLYNOMIAL EQUATIONS We will assume in this appendix that you know how to divide polynomials using long division and synthetic division. If you need to review those techniques, refer to an algebra
More informationDiscuss the size of the instance for the minimum spanning tree problem.
3.1 Algorithm complexity The algorithms A, B are given. The former has complexity O(n 2 ), the latter O(2 n ), where n is the size of the instance. Let n A 0 be the size of the largest instance that can
More informationLean Six Sigma Analyze Phase Introduction. TECH 50800 QUALITY and PRODUCTIVITY in INDUSTRY and TECHNOLOGY
TECH 50800 QUALITY and PRODUCTIVITY in INDUSTRY and TECHNOLOGY Before we begin: Turn on the sound on your computer. There is audio to accompany this presentation. Audio will accompany most of the online
More information3. Mathematical Induction
3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)
More informationPartial Fractions Decomposition
Partial Fractions Decomposition Dr. Philippe B. Laval Kennesaw State University August 6, 008 Abstract This handout describes partial fractions decomposition and how it can be used when integrating rational
More informationThe Binomial Distribution
The Binomial Distribution James H. Steiger November 10, 00 1 Topics for this Module 1. The Binomial Process. The Binomial Random Variable. The Binomial Distribution (a) Computing the Binomial pdf (b) Computing
More informationDynamic TCP Acknowledgement: Penalizing Long Delays
Dynamic TCP Acknowledgement: Penalizing Long Delays Karousatou Christina Network Algorithms June 8, 2010 Karousatou Christina (Network Algorithms) Dynamic TCP Acknowledgement June 8, 2010 1 / 63 Layout
More informationNotes from Week 1: Algorithms for sequential prediction
CS 683 Learning, Games, and Electronic Markets Spring 2007 Notes from Week 1: Algorithms for sequential prediction Instructor: Robert Kleinberg 22-26 Jan 2007 1 Introduction In this course we will be looking
More information20 Selfish Load Balancing
20 Selfish Load Balancing Berthold Vöcking Abstract Suppose that a set of weighted tasks shall be assigned to a set of machines with possibly different speeds such that the load is distributed evenly among
More informationSolving Rational Equations
Lesson M Lesson : Student Outcomes Students solve rational equations, monitoring for the creation of extraneous solutions. Lesson Notes In the preceding lessons, students learned to add, subtract, multiply,
More informationrecursion, O(n), linked lists 6/14
recursion, O(n), linked lists 6/14 recursion reducing the amount of data to process and processing a smaller amount of data example: process one item in a list, recursively process the rest of the list
More informationChapter 6. Cuboids. and. vol(conv(p ))
Chapter 6 Cuboids We have already seen that we can efficiently find the bounding box Q(P ) and an arbitrarily good approximation to the smallest enclosing ball B(P ) of a set P R d. Unfortunately, both
More informationContinued Fractions and the Euclidean Algorithm
Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction
More informationI. GROUPS: BASIC DEFINITIONS AND EXAMPLES
I GROUPS: BASIC DEFINITIONS AND EXAMPLES Definition 1: An operation on a set G is a function : G G G Definition 2: A group is a set G which is equipped with an operation and a special element e G, called
More informationScheduling Real-time Tasks: Algorithms and Complexity
Scheduling Real-time Tasks: Algorithms and Complexity Sanjoy Baruah The University of North Carolina at Chapel Hill Email: baruah@cs.unc.edu Joël Goossens Université Libre de Bruxelles Email: joel.goossens@ulb.ac.be
More informationCMSC 858T: Randomized Algorithms Spring 2003 Handout 8: The Local Lemma
CMSC 858T: Randomized Algorithms Spring 2003 Handout 8: The Local Lemma Please Note: The references at the end are given for extra reading if you are interested in exploring these ideas further. You are
More informationZeros of Polynomial Functions
Zeros of Polynomial Functions The Rational Zero Theorem If f (x) = a n x n + a n-1 x n-1 + + a 1 x + a 0 has integer coefficients and p/q (where p/q is reduced) is a rational zero, then p is a factor of
More informationCONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12
CONTINUED FRACTIONS AND PELL S EQUATION SEUNG HYUN YANG Abstract. In this REU paper, I will use some important characteristics of continued fractions to give the complete set of solutions to Pell s equation.
More information