# CS420/520 Algorithm Analysis Spring 2010 Lecture 04

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 CS420/520 Algorithm Analysis Spring 2010 Lecture 04 I. Chapter 4 Recurrences A. Introduction 1. Three steps applied at each level of a recursion a) Divide into a number of subproblems that are smaller instances of the same problem b) Conquer solve the subproblems recursively unless the subproblems from a base case in which they are solved in some direct manner c) Combine through some mechanism combine the intermediate subproblem results into the results for the entire problem; sometimes involves solving subproblems that aren t quite the same as the original problem 2. Recurrences. a) a recurrence is an equation or inequality that describes a function in terms of its values on smaller inputs (1) MERGE-SORT worst case running time (2) (3) is the solution we saw in Chapter 2 b) Recurrences need not split problem into equal-sized subparts (1). c) Sometimes we just chip away at the problem. (1) 3. Text will cover a) Substitution method guess a bound and then use mathematical indication to prove our guess correct b) Recursion-tree method nodes represent costs incurred at various levels of the recursion and use techniques for bounding summations to solve the recurrence c) Master Method provides bounds for some recurrences of the form, where a 1, b 1 and f(n) is a given function 4. Notes from Baase & Van Gelder a) Common Recurrence Equations (page 133 ff; notation converted to match our text book) (1) Intro (a) subproblems refers to a smaller instance of the main problem to be solved by a recursive call a and b are constants in each problem (b) (2) Divide and Conquer (a) The sizes of subproblems are known to be n/2 or some other fixed fraction of n (b) In general, the main problem of size n can Spring

2 II. be divided into a subproblems (a 1) of size n/b (b > 1). There is also some nonrecursive cost f(n) (to split the problem into subproblems and/or combine the solutions of the subproblems into a solution of the main problem) (c) a is called the branching factor (d) T ( n) at n / b f ( n ) (3) Chip and Conquer (a) Main problem of size n can be chipped down to one subproblem of size n b, where b > 0, with nonrecursive cost f(n) to create the subproblem and/or extend the solution of the subproblem into a solution of the overall problem. (i) T(n) = T(n - b) + f(n) (4) Chip and Be Conquered (a) The main problem of size n can be chipped down to a subproblems (a 1) each of size n b, where b > 0, with nonrecursive cost f(n) to split up the problem into subproblems and/or to combine the solutions of the subproblems into a solution of the main problem. Call a the branching factor (i) T(n) = a T(n - b) + f(n) (b) If the subproblems have various sizes, all within some range n b max to n b min, then upper and lower bounds can be obtained using b max and b min, respectively in place of b in the equations 5. Sometimes have recurrences that are not equalities but rather inequalities such as a) Such a recurrence states only an upper bound on T(n) so we will use O-notation rather than -notation b) then the recurrence gives only a lower bound and we will use -notation 6. Technicalities. a) assumption of integer arguments to functions (floor & ceiling notation) b) MERGE-SORT is really (1). c) typically ignore boundary conditions (1) generally have T(n) (1) for sufficiently small n d) when we solve and state recurrences (1) omit floors, ceilings, and boundary conditions (2) they do sometimes matter 4.1 The maximum-subarray problem Spring

3 A. Problem setup 1. You are allowed to buy a single unit of stock once and sell it at a later date 2. Buying and selling are after the close of trading for the day 3. You are allowed to learn what the price of the stock will be in the future 4. Goal is to maximize profit B. You might not be able to buy at the lowest process then sell at the highest price within a given period 1. For example lowest price may occur in a future day after the highest price C. A brute force solution 1. Try every possible pair of buy and sell dates in which the buy date precedes the sell date 2. Combinatiorial number of pairs to check 3. Evaluating each combinations in at best constant time places a lower bound on the running time of the algorithm for a list of length n, D. A transformation 1. Might we design an algorithm so that? 2. Find a sequence of days over which the net change from the first day to the last day is maximized 3. Instead of looking at daily price look a daily change in price (first differences which approximate slope of first derivative) and place these differences in array A 4. Looking for non-empty, contiguous subarray of A whose values have the largest sum 5. Still looks like we have to check subarrays for a period of n days a) Can organize the computation so that each subarray takes constant time to compute, given the values of previously computed sub array sums b) So can bound the brute force solution above and below by n 2,. E. A solution using divide-and-conquer 1. Suppose we want a maximum-subarray of the subarray A[low high] a) Divide into two subarrays of as equal size as possible b) A[low mid] and A[mid+1 high] 2. Figure 4.4 (a) page 71 analysis a) Any contiguous subarray A[i j] of A[low high] must lie in exactly one of the following places (1) Entirely in the subarray A[low mid] so that low i j mid (2) Entirely in the subarray A[mid+1 high] so that mid i j high (3) Crossing the midpoint so that low i mid j Spring

4 high b) A maximum subarray of A[low high] must lie in exactly one of these places c) Need to find a maximum subarray that crosses the midpoint and take a subarray with the largest sum of the three d) Finding a maximum subarray crossing the midpoint in time linear in the size of the subarray A[low high] (1) Not a smaller instance of the original problem because it has the added restriction that the subarray it chooses must cross an endpoint (2) Any subarray crossing the midpointis itself made of two subarrays A[i mid] A[mid+1 j] where low i mid j high (3) We need to find the maximum subarrays of the form A[i mid] A[mid+1 j] and then combine them 3. FIND-MAX-CROSSING-SUBARRAY algorithm a) Analysis of linear runtime on page FIND-MAXIMUM-SUBARRAY algorithm a) Divide and conquer algorithm for the problem b) Note that lines 6-11 are the combine parts of the divide-andconquer algorithm 5. Analyzing the divide-and-conquer algorithm a) First assume that the original problem is a power of 2 in size b) c) d) Later we ll see that III. 4.2 Strassen s algorithm for matrix multiplication A. Standard method for multiplying two square matrices 1. SQUARE-MATRIX-MULTIPLY (A,B) a) Due to triple-nested for loops, each running n times and each operation is constant time, total time T(n) O(n 3 ) b) Input matrices A and B c) Output matrix C. B. What about the lower bound? 1. Is it T(n) (n 3 )? 2. No because we have a way to multiply square matrics in T(n) o(n 3 ) 3. [So ask class what is the difference between O(n 3 ) and o(n 3 )] 4. Strassen s method T(n) O(n lg7 ) C. A simple divide-and-conquer algorithm 1. Assume that n is a power of two (to avoid problems with floor/ceiling when doing divide steps) 2. In each divide step, divide n x n matrices into four n/2 x n/2 matrices 3. Partitions produced and method of combination a), Spring

5 D. Algorithm SQUARE-MATRIX-MULTIPLY-RECURSIVE(A,B) 1. How does line 5 actually work? a) We have to avoid a naïve approach to creating the 12 submatrices in the partition which could take at most O(n 2 ) time copying entries b) [ASK STUDENTS TO EXPLAIN WHY O(n 2 ) WOULD BE NEEDED]. 2. Use row/column indexes for submatrices a) Can execute line 5 in O(1) time b) [COMMENT that it makes no difference asymptotically to the overall runtime whether we copy or partition in place] 3. Runtime of SQUARE-MATRIX-MULTIPLY-RECURSIVE(A,B) a) When n = 1, T(n) (1) because just one scalar multiplication on line 4 b) When n > 5 (1) Line 5 T(n) (1) using index calculations (2) Lines 6-9 make eight recursive calls 8T(n/2) (3) Lines 6-9 Four matrix additions, each containing n 2 /4 so each adds (n 2 ) time (4) T(n) = (1) + 8T(n/2) + (n 2 ) (5) T(n) = 8T(n/2) + (n 2 ) c) [COMMENT now we see why it makes no difference asymptotically to the overall runtime whether we copy or partition in place] d) e) This recurrence has solution T(n) ( n 3 ) f) Analysis page 78 why we the asymptotic notation summarizes the constant terms in the work we just analyzed g) Though asymptotic notation subsumes constant multiplicative factors, the recursive notation at(n/b) does not. 4. So we haven t done any better asymptotically from our initial approach E. Strassen s Method 1. Key is to reduce the number of recursive multiplications from 8 to 7 a) This increases the number of additions required for a solution but reduces by a matrix multiplication 2. Steps a) Step 1: Divide the input matrices A and B and output matrix C into n/2 x n/2 matrices as Equation 4.9 Spring

6 (1) Step takes (1) using index calculations b) Step 2: Create 10 different matrices S 1, S 2, S 10 each of which is an n/2 x n/2 matrix and each is the sum or difference of two matrices created in Step 1 (1) This process takes (n 2 ) time c) Step 3: using the submatrices from Step 1 and the matrices from Step 10, recursively compute seven matrix products P 1, P 2, P 7 each of which is an n/2 x n/2 matrix d) Step 4: compute the result submatrices C 11, C 12, C 21, C 22 by adding and subtracting various combinations of the P i matrices (1) This process takes (n 2 ) time 3. Initial Analysis a) When n = 1, T(n) (1) because just one scalar multiplication on line 4 b) When n > 1 Steps 1, 2, and 4 take a total of (n 2 ) time and Step 3 takes seven multiplications of n/2 x n/2 matrices c). d) So have traded off one matrix multiplication for a constant number of matrix additions 4. Details of Step 2 Creation of S 1, S 2,, S 10 (page 80) 5. Details of Step 3 Creation of P 2,, P 7 (page 80) 6. Details of Step 4 Creation of C 11, C 12, C 21, C 22 (pages 80-81) a) We add or subtract n/2 x n/2 matrices eight times so the step takes (n 2 ) time F. Overall, Recurrence has solution T(n) ( n lg7 ) IV. 4.3 The substitution method for solving recurrences. A. The substitution method - guess a bound and then use mathematical induction to prove our guess correct 1. guess the form of the solution 2. use mathematical induction to find constants and prove that the solution works 3. can establish either upper (Big-Oh) or lower bounds (Big-Omega) on a recurrence 4. may have to extend boundary conditions to make the inductive assumption work for small n 5. (see hand notes pages 2 and 2A). B. making a good guess 1. heuristics a) when n is large, what is the behavior b) prove loose upper and lower bounds on the recurrence and then reduce the range of uncertainty 2. (see hand notes pages 3A). C. subtleties 1. inductive assumption may not be strong enough to prove the detailed bound Spring

7 a) page 85 example, the result of the substitution results in (cn + 1) which is not the exact form of the guessed asymptotic bound and is greater than it as well b) Off only by a constant of revise the guess by subtracting a lower-order term a) seeking <something you want> - <something greater than 0>. 3. can prove something stronger for a given value by assuming something stronger for smaller values D. avoiding pitfalls 1. we need the exact form of the hypothesis to result from the substitution method s computations E. (hand example page 3B, 4) F. changing variables 1. example pages V. The iteration method (not covered in the CLRS 3 rd Edition)- converts the recurrence into a summation and then relies on techniques for bounding summations to solve the recurrence A. doesn't require a guess B. may require more algebra than the substitution method C. solve by expanding the recurrence and express it as a summation of terms dependent only on n and the initial conditions D. the key is to focus on two parameters 1. the number of times the recurrence needs to be iterated to reach the boundary condition 2. the sum of the terms arising from each level of the iteration process 3. often assume recurrence defined only on exact powers of a number E. (see hand notes page 5 and 5a). VI. 4.4 The recursion tree method for solving recurrences A. Introduction 1. Each node represents the cost of a single subproblem somewhere in the set of recursive function invocations 2. Sum the costs within each level of the tree to obtain a set of perlevel costs 3. Sum all per-level costs to determine total cost of recursion 4. Best used to generate a good guess which is then verified by the substitution method 5. If careful, can use as a direct proof of solution B. Example pg ) 1. When do we hit the base case? 2. The subproblem size for a node at depth i is n/4 i, so solve n/4 i = 1 and solution i = log 4 n 3. Number of levels includes 1 for depth 0 to log 4 n 4. Add up costs over all levels in the tree; a decreasing geometric series 5. In this case, cost of the root dominates the total cost of the tree 6. Check guess via the substitution method C. Example pg ) 1. Longest simple path from root to a leaf for Upper Bound analysis 2. (check math on page 92). 3. We expect solution to the recurrence to be cost of each level * Spring

8 number of levels 4. In this case, consider the cost of the leaves which if the cost of each leaf is constant is which is but the tree is not a complete binary tree and has fewer than leaves 5. Check guess O(nlgn) with substitution method. D. Recursion Tree Rules (Baase & Van Gelder pp136 ff) 1. The work copy of the recurrence equation uses a different variable from the original copy; it is called the auxiliary variable. Let k be the auxiliary variable for the purposes of discussion. The left side of the original copy of the recurrence equation (assume it is T(n)) becomes the size field of the root node for the recursion tree 2. An incomplete node has a value for its size field, but not for its nonrecursive cost 3. The process of determining the nonrecursive cost field and the children of an incomplete node is called the expansion of that node. We take the size field in the node to be expanded and substitute it for the auxiliary variable k in our work copy of the recurrence equation. The resulting terms containing T on the right side of that equation become children of the node being expanded; all remaining terms become that node s nonrecursive cost 4. Expanding a base-case size gives the nonrecursive cost field and no children. (usually assume base case cost of 1) E. Recursion tree evaluation (Baase & Van Gelder pp136 ff) 1. Size of field of root = nonrecursive cost of expanded nodes + size fields of incomplete nodes 2. First sum the nonrecursive costs of all nodes at the same depth (the row-sum for that tree depth) 3. Sum over those row-sums over all depths 4. Usually need to know the maximum depth of the recursion tree (the depth at which the size parameter reduces to a base case) F. Divide-and-Conquer, General Case (Baase & Van Gelder pp137 ff) 1. The size parameter decreases by a factor of b each time the depth increases 2. Base case occurs when (n / b D ) = 1, where D is the node depth for base-case-nodes 3. D = lg(n) / lg (b) (log(n)) 4. Do not assume that row-sums are the same at all depths 5. How many leaves does a tree have? a) Branching factor a b) Number of nodes at depth D is L = a D c) Transform by lg(l) = D lg(a) = (lg(a))/(lg(b)) * lg(n) d) The critical exponent is E = lg(a) / lg(b) = log b a e) Therefore the number of leaves in a recursion tree is approximately L = n E G. Chip and Conquer, or Be conquered (Baase & Van Gelder pp139 ff) 1. If the branching factor, a > 1, then a) T(n) = a T(n - b) + f(n) b) The total for the tree is exponential in n even when the most favorable assumption f(n) = 1 is made Spring

9 c) T( n) n/ b n/ b d n/ b f ( bh) a f ( n bd) a h d 0 h 0 a d) in most practical cases the last sum is (1), then T(n) ( a n/b ), T(n) 1 1 T(n b) 1 T(n b) 1 2 T(n 2b) 1 T(n 2b) 1 T(n 2b) 1 T(n 2b) 1 4 e) 2. if the branching factor a = 1 then n/ b n/ b n d 1 T( n) a f ( n bd) f ( bh) f ( x) dx b d 0 h 0 0 a) if f(n) is a polynomial n α then T(n) ( n α+1 ), b) if f(n) is a polynomial log(n) then T(n) (n log(n)) H. recursion examples stress check by substitution method VII. 4.5 The master method for solving recurrences A. provides bounds for recurrences of a special (but often occurring form) T(n) = at(n/b) + f(n) 1. a 1, b>1 are constants 2. f(n) is an asymptotically positive function B. divide the problem of size n into a subproblems of size (n/b) 1. a subproblems solved recursively in time T(n/b) 2. cost of dividing and combining is described by f(n) C. Little Master Theorem (Baase & Van Gelder pp138 ff) 1. If the row-sums form an increasing geometric series (starting from row 0 at the top of the tree), then T(n) ( n E ), where E is the critical exponent. This means that the cost is proportional to the number of leaves in the recursion tree a) Geometric series D d n 1 ar a r r d If the row-sums remain about constant then T(n) ( f(n) log(n)) 3. If the row-sums form a decreasing geometric series, k 0 k x 1 1 x when r 1 then T(n) ( f(n) ), which is proportional to the cost of the root D. Theorem 4.1 (Master Theorem) 8 (2 2/b ) Spring

10 log b a n 1. in each case comparing f(n) to 2. solution to the recurrence is determined by the larger of the two functions 3. log in case 1, f(n) must be polynomially smaller than b a n a) log b a f(n) must be asymptotically smaller than n by a factor of n for some constant > case 3, f(n) must be polynomially larger... and satisfy the "regularity" condition that a(f(n/b) cf(n). 5. if f(n) falls in these gaps, the master method cannot be used log b a n a) gap between cases 1 and 2 when f(n) is smaller than but not polynomially smaller b) log gap between cases 2 and 3 when f(n) is larger than b a n but not polynomially larger E. Using the master method 1. (examples page 95-96) 2. (examples in hand notes). VIII. 4.6 Proof of the master theorem A The proof for exact powers 1. figure 4.7 assumes n is an exact power of b > 1, where b need not be an integer 2. generalizations page Restatement of theorem page 102 as Lemma 4.4 B Floors and ceilings 1. proof given for upper bounds only Spring

### Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4

Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4 I. Algorithm Design and Divide-and-Conquer There are various strategies we

### 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

### CS473 - 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

### Format of Divide-and-Conquer algorithms:

CS 360: Data Structures and Algorithms Divide-and-Conquer (part 1) Format of Divide-and-Conquer algorithms: Divide: Split the array or list into smaller pieces Conquer: Solve the same problem recursively

### Divide And Conquer Algorithms

CSE341T/CSE549T 09/10/2014 Lecture 5 Divide And Conquer Algorithms Recall in last lecture, we looked at one way of parallelizing matrix multiplication. At the end of the lecture, we saw the reduce SUM

### CS 102: SOLUTIONS TO DIVIDE AND CONQUER ALGORITHMS (ASSGN 4)

CS 10: SOLUTIONS TO DIVIDE AND CONQUER ALGORITHMS (ASSGN 4) Problem 1. a. Consider the modified binary search algorithm so that it splits the input not into two sets of almost-equal sizes, but into three

### Binary Search. Search for x in a sorted array A.

Divide and Conquer A general paradigm for algorithm design; inspired by emperors and colonizers. Three-step process: 1. Divide the problem into smaller problems. 2. Conquer by solving these problems. 3.

### CSE373: 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

### Full 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

### Recursive 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

### Algebra I Credit Recovery

Algebra I Credit Recovery COURSE DESCRIPTION: The purpose of this course is to allow the student to gain mastery in working with and evaluating mathematical expressions, equations, graphs, and other topics,

### Quicksort is a divide-and-conquer sorting algorithm in which division is dynamically carried out (as opposed to static division in Mergesort).

Chapter 7: Quicksort Quicksort is a divide-and-conquer sorting algorithm in which division is dynamically carried out (as opposed to static division in Mergesort). The three steps of Quicksort are as follows:

### Divide-and-Conquer Algorithms Part Four

Divide-and-Conquer Algorithms Part Four Announcements Problem Set 2 due right now. Can submit by Monday at 2:15PM using one late period. Problem Set 3 out, due July 22. Play around with divide-and-conquer

### CSC148 Lecture 8. Algorithm Analysis Binary Search Sorting

CSC148 Lecture 8 Algorithm Analysis Binary Search Sorting Algorithm Analysis Recall definition of Big Oh: We say a function f(n) is O(g(n)) if there exists positive constants c,b such that f(n)

### Divide and Conquer. Textbook Reading Chapters 4, 7 & 33.4

Divide d Conquer Textook Reading Chapters 4, 7 & 33.4 Overview Design principle Divide d conquer Proof technique Induction, induction, induction Analysis technique Recurrence relations Prolems Sorting

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

Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)

### CS473 - 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

### Indiana State Core Curriculum Standards updated 2009 Algebra I

Indiana State Core Curriculum Standards updated 2009 Algebra I Strand Description Boardworks High School Algebra presentations Operations With Real Numbers Linear Equations and A1.1 Students simplify and

### Introduction 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

### Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction

Lecture 11 Dynamic Programming 11.1 Overview Dynamic Programming is a powerful technique that allows one to solve many different types of problems in time O(n 2 ) or O(n 3 ) for which a naive approach

### CMPS 102 Solutions to Homework 1

CMPS 0 Solutions to Homework Lindsay Brown, lbrown@soe.ucsc.edu September 9, 005 Problem..- p. 3 For inputs of size n insertion sort runs in 8n steps, while merge sort runs in 64n lg n steps. For which

### Today s Outline. Exercise. Binary Search Analysis. Linear Search Analysis. Asymptotic Analysis. Analyzing Code. Announcements. Asymptotic Analysis

Today s Outline Announcements Assignment #1 due Thurs, Oct 7 at 11:45pm Asymptotic Analysis Asymptotic Analysis CSE 7 Data Structures & Algorithms Ruth Anderson Autumn 2010 Exercise Analyzing Code bool

### Data Structures. Algorithm Performance and Big O Analysis

Data Structures Algorithm Performance and Big O Analysis What s an Algorithm? a clearly specified set of instructions to be followed to solve a problem. In essence: A computer program. In detail: Defined

### Data Structures and Algorithms Written Examination

Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where

### Lecture 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

### Thinkwell s Homeschool Algebra 2 Course Lesson Plan: 34 weeks

Thinkwell s Homeschool Algebra 2 Course Lesson Plan: 34 weeks Welcome to Thinkwell s Homeschool Algebra 2! We re thrilled that you ve decided to make us part of your homeschool curriculum. This lesson

### Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.

Some Polynomial Theorems by John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.com This paper contains a collection of 31 theorems, lemmas,

### 8.1 Makespan Scheduling

600.469 / 600.669 Approximation Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programing: Min-Makespan and Bin Packing Date: 2/19/15 Scribe: Gabriel Kaptchuk 8.1 Makespan Scheduling Consider an instance

### Appendix: Solving Recurrences [Fa 10] Wil Wheaton: Embrace the dark side! Sheldon: That s not even from your franchise!

Change is certain. Peace is followed by disturbances; departure of evil men by their return. Such recurrences should not constitute occasions for sadness but realities for awareness, so that one may be

### Lecture 3: Linear Programming Relaxations and Rounding

Lecture 3: Linear Programming Relaxations and Rounding 1 Approximation Algorithms and Linear Relaxations For the time being, suppose we have a minimization problem. Many times, the problem at hand can

### Approximation 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

### Class Overview. CSE 326: Data Structures. Goals. Goals. Data Structures. Goals. Introduction

Class Overview CSE 326: Data Structures Introduction Introduction to many of the basic data structures used in computer software Understand the data structures Analyze the algorithms that use them Know

### Lecture 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

### Binary 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

### Week 7: Divide and Conquer

Agenda: Divide and Conquer technique Multiplication of large integers Exponentiation Matrix multiplication 1 2- Divide and Conquer : To solve a problem we can break it into smaller subproblems, solve each

### the recursion-tree method

the recursion- method recurrence into a 1 recurrence into a 2 MCS 360 Lecture 39 Introduction to Data Structures Jan Verschelde, 22 November 2010 recurrence into a The for consists of two steps: 1 Guess

### Thnkwell s Homeschool Precalculus Course Lesson Plan: 36 weeks

Thnkwell s Homeschool Precalculus Course Lesson Plan: 36 weeks Welcome to Thinkwell s Homeschool Precalculus! We re thrilled that you ve decided to make us part of your homeschool curriculum. This lesson

### MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS Systems of Equations and Matrices Representation of a linear system The general system of m equations in n unknowns can be written a x + a 2 x 2 + + a n x n b a

### MODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction.

MODULAR ARITHMETIC 1 Working With Integers The usual arithmetic operations of addition, subtraction and multiplication can be performed on integers, and the result is always another integer Division, on

### The Running Time of Programs

CHAPTER 3 The Running Time of Programs In Chapter 2, we saw two radically different algorithms for sorting: selection sort and merge sort. There are, in fact, scores of algorithms for sorting. This situation

### College Algebra. Barnett, Raymond A., Michael R. Ziegler, and Karl E. Byleen. College Algebra, 8th edition, McGraw-Hill, 2008, ISBN: 978-0-07-286738-1

College Algebra Course Text Barnett, Raymond A., Michael R. Ziegler, and Karl E. Byleen. College Algebra, 8th edition, McGraw-Hill, 2008, ISBN: 978-0-07-286738-1 Course Description This course provides

### Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24

Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24 The final exam will cover seven topics. 1. greedy algorithms 2. divide-and-conquer algorithms

### Continued 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

### Mergesort and Quicksort

Mergesort Mergesort and Quicksort Basic plan: Divide array into two halves. Recursively sort each half. Merge two halves to make sorted whole. mergesort mergesort analysis quicksort quicksort analysis

### Introduction to Diophantine Equations

Introduction to Diophantine Equations Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles September, 2006 Abstract In this article we will only touch on a few tiny parts of the field

### MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS 1. SYSTEMS OF EQUATIONS AND MATRICES 1.1. Representation of a linear system. The general system of m equations in n unknowns can be written a 11 x 1 + a 12 x 2 +

### Situation 23: Simultaneous Equations Prepared at the University of Georgia EMAT 6500 class Date last revised: July 22 nd, 2013 Nicolina Scarpelli

Situation 23: Simultaneous Equations Prepared at the University of Georgia EMAT 6500 class Date last revised: July 22 nd, 2013 Nicolina Scarpelli Prompt: A mentor teacher and student teacher are discussing

### Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions.

Chapter 1 Vocabulary identity - A statement that equates two equivalent expressions. verbal model- A word equation that represents a real-life problem. algebraic expression - An expression with variables.

### Classification - Examples

Lecture 2 Scheduling 1 Classification - Examples 1 r j C max given: n jobs with processing times p 1,...,p n and release dates r 1,...,r n jobs have to be scheduled without preemption on one machine taking

### We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: 9081 + 900b + 90c = 9001 + 100c + 10b

In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should

### Algorithms. Margaret M. Fleck. 18 October 2010

Algorithms Margaret M. Fleck 18 October 2010 These notes cover how to analyze the running time of algorithms (sections 3.1, 3.3, 4.4, and 7.1 of Rosen). 1 Introduction The main reason for studying big-o

### Overview of Math Standards

Algebra 2 Welcome to math curriculum design maps for Manhattan- Ogden USD 383, striving to produce learners who are: Effective Communicators who clearly express ideas and effectively communicate with diverse

### 2.3 Scheduling jobs on identical parallel machines

2.3 Scheduling jobs on identical parallel machines There are jobs to be processed, and there are identical machines (running in parallel) to which each job may be assigned Each job = 1,,, must be processed

### Single machine models: Maximum Lateness -12- Approximation ratio for EDD for problem 1 r j,d j < 0 L max. structure of a schedule Q...

Lecture 4 Scheduling 1 Single machine models: Maximum Lateness -12- Approximation ratio for EDD for problem 1 r j,d j < 0 L max structure of a schedule 0 Q 1100 11 00 11 000 111 0 0 1 1 00 11 00 11 00

### Big Ideas in Mathematics

Big Ideas in Mathematics which are important to all mathematics learning. (Adapted from the NCTM Curriculum Focal Points, 2006) The Mathematics Big Ideas are organized using the PA Mathematics Standards

### Merge Sort. 2004 Goodrich, Tamassia. Merge Sort 1

Merge Sort 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9 7 7 2 2 9 9 4 4 Merge Sort 1 Divide-and-Conquer Divide-and conquer is a general algorithm design paradigm: Divide: divide the input data S in two disjoint subsets

### Analysis of Algorithms: The Non-recursive Case

Analysis of Algorithms: The Non-recursive Case Key topics: * Introduction * Generalizing Running Time * Doing a Timing Analysis * Big-Oh Notation * Big-Oh Operations * Analyzing Some Simple Programs -

### Faster 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

### DETERMINANTS. b 2. x 2

DETERMINANTS 1 Systems of two equations in two unknowns A system of two equations in two unknowns has the form a 11 x 1 + a 12 x 2 = b 1 a 21 x 1 + a 22 x 2 = b 2 This can be written more concisely in

### CS 103X: Discrete Structures Homework Assignment 3 Solutions

CS 103X: Discrete Structures Homework Assignment 3 s Exercise 1 (20 points). On well-ordering and induction: (a) Prove the induction principle from the well-ordering principle. (b) Prove the well-ordering

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

7 Catalan Numbers Thomas A. Dowling, Department of Mathematics, Ohio State Uni- Author: versity. Prerequisites: The prerequisites for this chapter are recursive definitions, basic counting principles,

### Lecture 1: Jan 14, 2015

E0 309: Topics in Complexity Theory Spring 2015 Lecture 1: Jan 14, 2015 Lecturer: Neeraj Kayal Scribe: Sumant Hegde and Abhijat Sharma 11 Introduction The theme of the course in this semester is Algebraic

### The 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 >

### Notes on Determinant

ENGG2012B Advanced Engineering Mathematics Notes on Determinant Lecturer: Kenneth Shum Lecture 9-18/02/2013 The determinant of a system of linear equations determines whether the solution is unique, without

### Notes on Factoring. MA 206 Kurt Bryan

The General Approach Notes on Factoring MA 26 Kurt Bryan Suppose I hand you n, a 2 digit integer and tell you that n is composite, with smallest prime factor around 5 digits. Finding a nontrivial factor

### The program also provides supplemental modules on topics in geometry and probability and statistics.

Algebra 1 Course Overview Students develop algebraic fluency by learning the skills needed to solve equations and perform important manipulations with numbers, variables, equations, and inequalities. Students

### Induction. Margaret M. Fleck. 10 October These notes cover mathematical induction and recursive definition

Induction Margaret M. Fleck 10 October 011 These notes cover mathematical induction and recursive definition 1 Introduction to induction At the start of the term, we saw the following formula for computing

### 8.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

### Prentice Hall: Middle School Math, Course 1 2002 Correlated to: New York Mathematics Learning Standards (Intermediate)

New York Mathematics Learning Standards (Intermediate) Mathematical Reasoning Key Idea: Students use MATHEMATICAL REASONING to analyze mathematical situations, make conjectures, gather evidence, and construct

### This unit will lay the groundwork for later units where the students will extend this knowledge to quadratic and exponential functions.

Algebra I Overview View unit yearlong overview here Many of the concepts presented in Algebra I are progressions of concepts that were introduced in grades 6 through 8. The content presented in this course

### Taylor Polynomials and Taylor Series Math 126

Taylor Polynomials and Taylor Series Math 26 In many problems in science and engineering we have a function f(x) which is too complicated to answer the questions we d like to ask. In this chapter, we will

### APPLICATIONS OF THE ORDER FUNCTION

APPLICATIONS OF THE ORDER FUNCTION LECTURE NOTES: MATH 432, CSUSM, SPRING 2009. PROF. WAYNE AITKEN In this lecture we will explore several applications of order functions including formulas for GCDs and

### csci 210: Data Structures Recursion

csci 210: Data Structures Recursion Summary Topics recursion overview simple examples Sierpinski gasket Hanoi towers Blob check READING: GT textbook chapter 3.5 Recursion In general, a method of defining

### MATH 10034 Fundamental Mathematics IV

MATH 0034 Fundamental Mathematics IV http://www.math.kent.edu/ebooks/0034/funmath4.pdf Department of Mathematical Sciences Kent State University January 2, 2009 ii Contents To the Instructor v Polynomials.

### 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,

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

### Information 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

### Lecture 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

### Algebra 1-2. A. Identify and translate variables and expressions.

St. Mary's College High School Algebra 1-2 The Language of Algebra What is a variable? A. Identify and translate variables and expressions. The following apply to all the skills How is a variable used

### Algebra I. In this technological age, mathematics is more important than ever. When students

In this technological age, mathematics is more important than ever. When students leave school, they are more and more likely to use mathematics in their work and everyday lives operating computer equipment,

### Classification - Examples -1- 1 r j C max given: n jobs with processing times p 1,..., p n and release dates

Lecture 2 Scheduling 1 Classification - Examples -1-1 r j C max given: n jobs with processing times p 1,..., p n and release dates r 1,..., r n jobs have to be scheduled without preemption on one machine

### Quiz 1 Solutions. (a) T F The height of any binary search tree with n nodes is O(log n). Explain:

Introduction to Algorithms March 9, 2011 Massachusetts Institute of Technology 6.006 Spring 2011 Professors Erik Demaine, Piotr Indyk, and Manolis Kellis Quiz 1 Solutions Problem 1. Quiz 1 Solutions True

### Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

### Induction Problems. Tom Davis November 7, 2005

Induction Problems Tom Davis tomrdavis@earthlin.net http://www.geometer.org/mathcircles November 7, 2005 All of the following problems should be proved by mathematical induction. The problems are not necessarily

### CLASS 3, GIVEN ON 9/27/2010, FOR MATH 25, FALL 2010

CLASS 3, GIVEN ON 9/27/2010, FOR MATH 25, FALL 2010 1. Greatest common divisor Suppose a, b are two integers. If another integer d satisfies d a, d b, we call d a common divisor of a, b. Notice that as

### The Inverse of a Square Matrix

These notes closely follow the presentation of the material given in David C Lay s textbook Linear Algebra and its Applications (3rd edition) These notes are intended primarily for in-class presentation

### Homework 5 Solutions

Homework 5 Solutions 4.2: 2: a. 321 = 256 + 64 + 1 = (01000001) 2 b. 1023 = 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = (1111111111) 2. Note that this is 1 less than the next power of 2, 1024, which

### 24. The Branch and Bound Method

24. The Branch and Bound Method It has serious practical consequences if it is known that a combinatorial problem is NP-complete. Then one can conclude according to the present state of science that no

### MATH 0110 Developmental Math Skills Review, 1 Credit, 3 hours lab

MATH 0110 Developmental Math Skills Review, 1 Credit, 3 hours lab MATH 0110 is established to accommodate students desiring non-course based remediation in developmental mathematics. This structure will

### Solving a System of Equations

11 Solving a System of Equations 11-1 Introduction The previous chapter has shown how to solve an algebraic equation with one variable. However, sometimes there is more than one unknown that must be determined

### Anchorage School District/Alaska Sr. High Math Performance Standards Algebra

Anchorage School District/Alaska Sr. High Math Performance Standards Algebra Algebra 1 2008 STANDARDS PERFORMANCE STANDARDS A1:1 Number Sense.1 Classify numbers as Real, Irrational, Rational, Integer,

### Norwalk La Mirada Unified School District. Algebra Scope and Sequence of Instruction

1 Algebra Scope and Sequence of Instruction Instructional Suggestions: Instructional strategies at this level should include connections back to prior learning activities from K-7. Students must demonstrate

### Solving 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,

### Florida Math for College Readiness

Core Florida Math for College Readiness Florida Math for College Readiness provides a fourth-year math curriculum focused on developing the mastery of skills identified as critical to postsecondary readiness

### Why? 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

### Math 313 Lecture #10 2.2: The Inverse of a Matrix

Math 1 Lecture #10 2.2: The Inverse of a Matrix Matrix algebra provides tools for creating many useful formulas just like real number algebra does. For example, a real number a is invertible if there is

### Series Convergence Tests Math 122 Calculus III D Joyce, Fall 2012

Some series converge, some diverge. Series Convergence Tests Math 22 Calculus III D Joyce, Fall 202 Geometric series. We ve already looked at these. We know when a geometric series converges and what it

### LAKE ELSINORE UNIFIED SCHOOL DISTRICT

LAKE ELSINORE UNIFIED SCHOOL DISTRICT Title: PLATO Algebra 1-Semester 2 Grade Level: 10-12 Department: Mathematics Credit: 5 Prerequisite: Letter grade of F and/or N/C in Algebra 1, Semester 2 Course Description: