Lecture 2: Analysis of Algorithms (CS )

Size: px
Start display at page:

Download "Lecture 2: Analysis of Algorithms (CS )"

Transcription

1 Lecture 2: Analysis of Algorithms (CS ) Amarda Shehu September 03 & 10, 2014

2 1 Outline of Today s Class 2 Big-Oh, Big-Omega, Theta Techniques for Finding Asymptotic Relationships Some more Fun with Math 3 4 Average-case Analysis Average-case Analysis of Insertion Sort

3 Big-Oh, Big-Omega, Theta Techniques for Finding Asymptotic Relationships Some more Fun with Math Big-Oh: An Asymptotic Upper Bound Definition A function g(n) O(f (n)) if constants c > 0 and n 0 s.t g(n) c f (n) n n 0. Note: O(f (n)) denotes a set. Graphical Illustration little-oh: Tight Asymptotic Upper Bound g(n) o(f (n)) when the upper bound holds for all constants c > 0. Alternative definition: lim n g(n) f (n) = 0

4 Big-Oh, Big-Omega, Theta Techniques for Finding Asymptotic Relationships Some more Fun with Math Big-Omega: An Asymptotic Lower Bound Definition A function g(n) Ω(f (n)) if constants c > 0 and n 0 s.t g(n) c f (n) n n 0. Note: Ω(f (n)) denotes a set. Graphical Illustration little-omega: Tight Asymptotic Lower Bound g(n) ω(f (n)) when the lower bound holds for all constants c > 0. Alternative definition: lim n g(n) f (n) =

5 Big-Oh, Big-Omega, Theta Techniques for Finding Asymptotic Relationships Some more Fun with Math Theta: Asymptotic Upper and Lower Bounds Definition A function g(n) Θ(f (n)) if g(n) O(f (n)) and g(n) Ω(f (n)). Alternatively, g(n) Θ(f (n)) if positive constants c 1, c 2 and n 0 s.t. c 1 f (n) g(n) c 2 f (n) n n 0. Graphical Illustration Alternative Definition g(n) θ(f (n)) when lim n g(n) f (n) = O(1)

6 Big-Oh, Big-Omega, Theta Techniques for Finding Asymptotic Relationships Some more Fun with Math Techniques for Bounding Functions When bounding functions 1 Go back to definitions of O, Ω, θ 2 Know when the notations do not apply: e.g., in cases of periodic functions like sin(n) 3 Find limits when n 1 Simple transformations: e.g., lim n (n)/n 2 L Hospital s Rule: e.g., lg(n) O( (n)) 3 Combinaton of both: e.g., n! ω(2 n ) 4 Recall techniques to evaluate derivatives: e.g., d dx (x x ) =?

7 Big-Oh, Big-Omega, Theta Techniques for Finding Asymptotic Relationships Some more Fun with Math Techniques for Bounding Summations When bounding Summations 1 Obtain answer for series (A.1) or derive it: n 1 i=0 (a 0 + id) = (n+1) (a0+an) 2 n 2 i=0 ai = an+1 1 a 1 for a > 1 If a i+1 a i r, sum over series n i=1 a0r i n 3 i=0 i 2i = (n 1) 2 n Guess the answer and prove by induction 3 Bound each of the terms: e.g., n i=1 1 O(lnn) k 2 4 Split the summation: e.g. k=0 k2 (A.2) 2 k 5 Bound by integral (recall techniques to evaluate integrals) 1 2 n i=1 1 i 2 n i=1 O(1) lg(i) θ(n lnn)

8 Big-Oh, Big-Omega, Theta Techniques for Finding Asymptotic Relationships Some more Fun with Math Flex your Muscles Moderate to Difficult Exercises 1 n i=0 ai O((n + 1) a n ) 2 lg k n o(n ɛ ), ɛ > 0, k 1 3 n k o(c n ), c > 1, k 1 4 Is lgn! polynomially bounded? 5 Is lglgn! polynomially bounded? Figure : The Koch snowflake illustrates the geometric series ar i with a = 1/3 and r = 4/9. Summation gives the area of this snowflake as 8/5 of the blue triangle. c wikipedia.

9 What is a Recurrence? A recurrence is an equation of inequality that describes a function in terms of its value on smaller inputs Example: T (n) of Mergesort is described in terms of T (n/2) Recurrences have boundary conditions (bottom out) Example: T (n) = c when n = 1 1 Iteration or expansion method 2 Recursion-tree method 3 Substitution method 4 5 Generating Functions

10 Outline of Today s Class Expand T (n) = 2T (n/2) + cn iterate down to boundary condition T (n) = 2T (n/2) + cn = 2 [2T (n/4) + c n 2 ] + cn = 4 [2T (n/8) + c n 4 ] + 2cn = 8 T (n/8) + 3cn = 2 3 T (n/2 3 ) + 3cn =... do you see the pattern? = 2 k T (n/2 k ) + kcn Since the recursion bottoms out at n = 1, k = lg(n). So: T (n) = n T (1) + lg(n) cn = cn + cn lg(n) θ(n lgn) Try to solve T (n) = T (n 1) + n, where T (1) = 1. Try to solve T (n) = 2T (n/2) + n, where T (1) = 1.

11 Build recursion tree for T (n) = 2T (n/2) + c n:

12 Example of Solve T (n) = T (n/4) + T (n/2) + n 2 :

13 Substitution (Induction) Method Guess that T (n) = 2T ( n 2 ) + n O(n + n lgn), where T (1) = 1. Then use induction to prove that the guess is correct. 1 Base Case: The boundary condition states that T (1) = 1. The guess states that T (1) O(1 + 1 lg1). Since, lg1 = 1 and 1 O(1), the guess is correct. 2 Inductive Step: Assuming that T ( n 2 ) O( n 2 + n 2 lg(n 2 )), we have to show that the guess holds for T (n): T (n) = 2T ( n 2 ) + n 2[c ( n 2 + n 2 lg(n 2 ))] + n, where c > 0 = c n + c n lgn cn + n = c n lgn + n Easy to show that c n lgn + n O(n + n lgn)

14 Outline of Today s Class Theorem: Let a 1 and b > 1 be constants, let f (n) be a function, and let T (n) be defined on the nonnegative integers by the recurrence T (n) = a T (n/b) + f (n), where n/b can mean n/b or n/b. 1 If f (n) O(n log ba ɛ ) for some constant ɛ > 0, then T (n) θ(n log ba ) 2 If f (n) θ(n log ba ), then T (n) θ(n log ba lgn) 3 If f (n) Ω(n log ba+ɛ ) for some constant ɛ > 0, and if a f (n/b) cf (n) for some constant c < 1 and all sufficiently large n, then T (n) θ(f (n)) Examples: T (n) = 9T (n/3) + n, T (n) = T ( 2n 3 ) + 1, T (n) = 3T ( n 4 ) + nlgn, T (n) = 2T ( n 2 ) + nlgn, T (n) = n T 2 ( n 2 ).

15 Idea Behind : Case 1.

16 Idea Behind : Case 1. Figure : The weight increases geometrically from the root to the leaves. The leaves hold a constant fraction of the total weight. T (n) θ(n log ba ).

17 Idea Behind : Case 2.

18 Idea Behind : Case 3.

19 One can use generating functions and characteristic equations to solve recurrences. This is a topic beyond the scope of this class. However, a simple example on the Fibonacci recurrence showcases the power of this technique for solving recurrences. Let us associate with the sequence {a n } the generating function a(x) = n=0 a nx n. In this way, the recurrence relation for {a n } can be interpreted as an equation for a(x). Example: Find the generating function for Fibonacci sequence and derive a closed form expression for the n th Fibonacci number.

20 Generating Function for Fibonacci Sequence Solution: Let F (x) = n=0 f nx n be the generating function for the Fibonacci sequence. Since the sequence satisfies the recurrence f n = f n 1 + f n 2, an explicit form for F (x) when n 2 as follows: f n = f n 1 + f n 2 f n x n = f n 1 x n + f n 2 x n n=2 f nx n = n=2 f n 1x n + n=2 f n 2x n n=2 f nx n = x n=1 f nx n + x 2 n=0 f nx n So: F (x) f 0 xf 1 = x(f (x) f 0 ) + x 2 F (x) F (x)(1 x x 2 ) = f 0 + x(f 1 f 0 ) = x x F (x) = 1 x x 2

21 Closed Form Expression for Fibonacci Sequence To get a closed form expression for f n, get a closed form expression for the coefficient of x n in the expansion of the generating function. This requires decomposing into partial fractions. 1 1 x x 2 = (1 x 5x 2 )2 ( 2 )2 = (1 x 5x 2 2 )(1 x 5x ) Let s write the above generally as 1 x x 2 = (1 bx)(1 cx), where b = (1 + 5)/2 and c = (1 5)/2. From this, then F (x) = 1/[(1 bx) (1 cx)] =...1/ 5 n 0 (bn+1 c n+1 )x n. So, for all n 0: f n = 1 [( 1 + (5) ) n+1 ( 1 (5) ) n+1 ] (5) 2 2

22 Average-case Analysis Average-case Analysis of Insertion Sort What does Mean refers to the use of probability theory in the analysis of algorithms It is often useful to to analyze the running time of an algorithm To perform a probabilistic analysis, we have to make assumptions on the distribution of inputs After such assumption, we compute an expected running time that is computed over the distribution of all possible inputs In problems where it is not possible to describe an input distribution, probabilistic analysis is not applicable

23 Average-case Analysis Average-case Analysis of Insertion Sort Some Basic Probability Given a sample space S and an event A (which takes values from S), the indicator random variable I(A) associated with the event A is defined as: { 1 if A occurs I (A) = 0 if A does not occur Question: Can you determine the expected number of heads obtained when flipping a fair coin? Sample space S = {H, T }, where H and T refer to Head or Tail. The event A = H The indicator random variable: X H = I (H) = { 1 if H occurs 0 if T occurs

24 Average-case Analysis Average-case Analysis of Insertion Sort Simple Example The expected number of H s from one flip of the coin is the expected value of the indicator random variable X H : E[X H ] = E[I (H)] = 1 P(H) + 0 P(T ) = 1 (1/2) + 0 (1/2) = 1/2 Expected number of H s from one flip of a fair coin is 1/2. Indicator random variables are useful to analyze situations in which one performs repeated random trials (Bernoulli trials). Q: What is the expected number of H s in n flips of a fair coin? Let X i = I {the i th flip results in H} and X = n i=1 X i the total number of H s in n flips. Then: Then: E[X ] = E[ n i=1 X i] = n i=1 E[X i] = n i=1 1/2 = n/2

25 Average-case Analysis Average-case Analysis of Insertion Sort Probability Analysis for Average Case Performance Recall that the worst-case running time T (n) of an algorithm refers to the maximum time of the algorithm on any input of size n. The is also known as the usual case. The best-case T (n) is when a slow algorithm cheats by working fast on some particular input. This is also known as the bogus case. The average-case T (n) refers to the expected time of the algorithm over all inputs of size n. This is known as the sometimes case. Average-case analysis needs assumption of statistical distribution of inputs Employ probabilistic analysis to show that the average-case T (n) of insertion sort is θ(n 2 )

26 Average-case Analysis Average-case Analysis of Insertion Sort Average-case Analysis of Insertion Sort Recall that T (n) of insertion sort is n j=2 f (n), where f (n) sums the execution time of the inner while loop. Ignoring the machine-dependent constants, f (n) measures the number of times the elements in A[1...j 1] have to be moved right to open up the correct position where to insert the value in A[j]. Hence, f (n) records the expected number of moves so A[j] is in correct position. Question: What is f (n)?

27 Average-case Analysis Average-case Analysis of Insertion Sort Average-case Analysis of Insertion Sort Let k denote the total number of moves to the right and k i denote the number of moves when A[i] > A j. Then: E(k) = j 1 i=1 Prob.(A[i] > A[j]) k i = j 1 i=1 1 j (j i) = 1 j j 1 i=1 (j i) = 1 j [ j 1 i=1 j j 1 i=1 i] = 1 j [j j j (j 1) 2 ] = j j 1 2 = 2j j+1 2 = j+1 2 So, T (n) = n j=2 j+1 2 = (n+4) (n 1) 4 θ(n 2 )

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

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 information

the recursion-tree method

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

More information

Recursive Algorithms. Recursion. Motivating Example Factorial Recall the factorial function. { 1 if n = 1 n! = n (n 1)! if n > 1

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

More information

CSC148 Lecture 8. Algorithm Analysis Binary Search Sorting

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)

More information

CS473 - Algorithms I

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

More information

Section IV.1: Recursive Algorithms and Recursion Trees

Section IV.1: Recursive Algorithms and Recursion Trees Section IV.1: Recursive Algorithms and Recursion Trees Definition IV.1.1: A recursive algorithm is an algorithm that solves a problem by (1) reducing it to an instance of the same problem with smaller

More information

CS473 - Algorithms I

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

More information

Lecture 1: Course overview, circuits, and formulas

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

More information

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

HOMEWORK 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 information

2010 Solutions. a + b. a + b 1. (a + b)2 + (b a) 2. (b2 + a 2 ) 2 (a 2 b 2 ) 2

2010 Solutions. a + b. a + b 1. (a + b)2 + (b a) 2. (b2 + a 2 ) 2 (a 2 b 2 ) 2 00 Problem If a and b are nonzero real numbers such that a b, compute the value of the expression ( ) ( b a + a a + b b b a + b a ) ( + ) a b b a + b a +. b a a b Answer: 8. Solution: Let s simplify the

More information

Partial Fractions. (x 1)(x 2 + 1)

Partial Fractions. (x 1)(x 2 + 1) Partial Fractions Adding rational functions involves finding a common denominator, rewriting each fraction so that it has that denominator, then adding. For example, 3x x 1 3x(x 1) (x + 1)(x 1) + 1(x +

More information

Outline BST Operations Worst case Average case Balancing AVL Red-black B-trees. Binary Search Trees. Lecturer: Georgy Gimel farb

Outline 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 information

1 Lecture: Integration of rational functions by decomposition

1 Lecture: Integration of rational functions by decomposition Lecture: Integration of rational functions by decomposition into partial fractions Recognize and integrate basic rational functions, except when the denominator is a power of an irreducible quadratic.

More information

Math 115 Spring 2011 Written Homework 5 Solutions

Math 115 Spring 2011 Written Homework 5 Solutions . Evaluate each series. a) 4 7 0... 55 Math 5 Spring 0 Written Homework 5 Solutions Solution: We note that the associated sequence, 4, 7, 0,..., 55 appears to be an arithmetic sequence. If the sequence

More information

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

Cost 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 information

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

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

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

More information

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

Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80)

Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80) Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80) CS 30, Winter 2016 by Prasad Jayanti 1. (10 points) Here is the famous Monty Hall Puzzle. Suppose you are on a game show, and you

More information

Math 55: Discrete Mathematics

Math 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 information

Lecture 13: Martingales

Lecture 13: Martingales Lecture 13: Martingales 1. Definition of a Martingale 1.1 Filtrations 1.2 Definition of a martingale and its basic properties 1.3 Sums of independent random variables and related models 1.4 Products of

More information

Continued Fractions and the Euclidean Algorithm

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

More information

3. INNER PRODUCT SPACES

3. INNER PRODUCT SPACES . INNER PRODUCT SPACES.. Definition So far we have studied abstract vector spaces. These are a generalisation of the geometric spaces R and R. But these have more structure than just that of a vector space.

More information

CM2202: Scientific Computing and Multimedia Applications General Maths: 2. Algebra - Factorisation

CM2202: Scientific Computing and Multimedia Applications General Maths: 2. Algebra - Factorisation CM2202: Scientific Computing and Multimedia Applications General Maths: 2. Algebra - Factorisation Prof. David Marshall School of Computer Science & Informatics Factorisation Factorisation is a way of

More information

Approximation Algorithms

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

More information

CS/COE 1501 http://cs.pitt.edu/~bill/1501/

CS/COE 1501 http://cs.pitt.edu/~bill/1501/ CS/COE 1501 http://cs.pitt.edu/~bill/1501/ Lecture 01 Course Introduction Meta-notes These notes are intended for use by students in CS1501 at the University of Pittsburgh. They are provided free of charge

More information

3.3. Solving Polynomial Equations. Introduction. Prerequisites. Learning Outcomes

3.3. Solving Polynomial Equations. Introduction. Prerequisites. Learning Outcomes Solving Polynomial Equations 3.3 Introduction Linear and quadratic equations, dealt within Sections 3.1 and 3.2, are members of a class of equations, called polynomial equations. These have the general

More information

JUST THE MATHS UNIT NUMBER 1.8. ALGEBRA 8 (Polynomials) A.J.Hobson

JUST THE MATHS UNIT NUMBER 1.8. ALGEBRA 8 (Polynomials) A.J.Hobson JUST THE MATHS UNIT NUMBER 1.8 ALGEBRA 8 (Polynomials) by A.J.Hobson 1.8.1 The factor theorem 1.8.2 Application to quadratic and cubic expressions 1.8.3 Cubic equations 1.8.4 Long division of polynomials

More information

SMT 2014 Algebra Test Solutions February 15, 2014

SMT 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 information

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

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

More information

Sequences and Series

Sequences and Series Sequences and Series Consider the following sum: 2 + 4 + 8 + 6 + + 2 i + The dots at the end indicate that the sum goes on forever. Does this make sense? Can we assign a numerical value to an infinite

More information

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

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,

More information

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

PUTNAM TRAINING POLYNOMIALS. Exercises 1. Find a polynomial with integral coefficients whose zeros include 2 + 5. PUTNAM TRAINING POLYNOMIALS (Last updated: November 17, 2015) Remark. This is a list of exercises on polynomials. Miguel A. Lerma Exercises 1. Find a polynomial with integral coefficients whose zeros include

More information

The Method of Partial Fractions Math 121 Calculus II Spring 2015

The Method of Partial Fractions Math 121 Calculus II Spring 2015 Rational functions. as The Method of Partial Fractions Math 11 Calculus II Spring 015 Recall that a rational function is a quotient of two polynomials such f(x) g(x) = 3x5 + x 3 + 16x x 60. The method

More information

3.6. Partial Fractions. Introduction. Prerequisites. Learning Outcomes

3.6. Partial Fractions. Introduction. Prerequisites. Learning Outcomes Partial Fractions 3.6 Introduction It is often helpful to break down a complicated algebraic fraction into a sum of simpler fractions. For 4x + 7 example it can be shown that x 2 + 3x + 2 has the same

More information

1.7. Partial Fractions. 1.7.1. Rational Functions and Partial Fractions. A rational function is a quotient of two polynomials: R(x) = P (x) Q(x).

1.7. Partial Fractions. 1.7.1. Rational Functions and Partial Fractions. A rational function is a quotient of two polynomials: R(x) = P (x) Q(x). .7. PRTIL FRCTIONS 3.7. Partial Fractions.7.. Rational Functions and Partial Fractions. rational function is a quotient of two polynomials: R(x) = P (x) Q(x). Here we discuss how to integrate rational

More information

Analysis of Binary Search algorithm and Selection Sort algorithm

Analysis of Binary Search algorithm and Selection Sort algorithm Analysis of Binary Search algorithm and Selection Sort algorithm In this section we shall take up two representative problems in computer science, work out the algorithms based on the best strategy to

More information

1 Review of Least Squares Solutions to Overdetermined Systems

1 Review of Least Squares Solutions to Overdetermined Systems cs4: introduction to numerical analysis /9/0 Lecture 7: Rectangular Systems and Numerical Integration Instructor: Professor Amos Ron Scribes: Mark Cowlishaw, Nathanael Fillmore Review of Least Squares

More information

10.2 Series and Convergence

10.2 Series and Convergence 10.2 Series and Convergence Write sums using sigma notation Find the partial sums of series and determine convergence or divergence of infinite series Find the N th partial sums of geometric series and

More information

Sequential Data Structures

Sequential 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 information

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

General Framework for an Iterative Solution of Ax b. Jacobi s Method 2.6 Iterative Solutions of Linear Systems 143 2.6 Iterative Solutions of Linear Systems Consistent linear systems in real life are solved in one of two ways: by direct calculation (using a matrix factorization,

More information

The Topsy-Turvy World of Continued Fractions [online]

The Topsy-Turvy World of Continued Fractions [online] Chapter 47 The Topsy-Turvy World of Continued Fractions [online] The other night, from cares exempt, I slept and what d you think I dreamt? I dreamt that somehow I had come, To dwell in Topsy-Turveydom!

More information

Algorithms and Methods for Distributed Storage Networks 9 Analysis of DHT Christian Schindelhauer

Algorithms and Methods for Distributed Storage Networks 9 Analysis of DHT Christian Schindelhauer Algorithms and Methods for 9 Analysis of DHT Institut für Informatik Wintersemester 2007/08 Distributed Hash-Table (DHT) Hash table does not work efficiently for inserting and deleting Distributed Hash-Table

More information

is identically equal to x 2 +3x +2

is identically equal to x 2 +3x +2 Partial fractions 3.6 Introduction It is often helpful to break down a complicated algebraic fraction into a sum of simpler fractions. 4x+7 For example it can be shown that has the same value as 1 + 3

More information

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics Undergraduate Notes in Mathematics Arkansas Tech University Department of Mathematics An Introductory Single Variable Real Analysis: A Learning Approach through Problem Solving Marcel B. Finan c All Rights

More information

Large induced subgraphs with all degrees odd

Large induced subgraphs with all degrees odd Large induced subgraphs with all degrees odd A.D. Scott Department of Pure Mathematics and Mathematical Statistics, University of Cambridge, England Abstract: We prove that every connected graph of order

More information

Real Roots of Univariate Polynomials with Real Coefficients

Real Roots of Univariate Polynomials with Real Coefficients Real Roots of Univariate Polynomials with Real Coefficients mostly written by Christina Hewitt March 22, 2012 1 Introduction Polynomial equations are used throughout mathematics. When solving polynomials

More information

Inner Product Spaces

Inner Product Spaces Math 571 Inner Product Spaces 1. Preliminaries An inner product space is a vector space V along with a function, called an inner product which associates each pair of vectors u, v with a scalar u, v, and

More information

Probability Generating Functions

Probability Generating Functions page 39 Chapter 3 Probability Generating Functions 3 Preamble: Generating Functions Generating functions are widely used in mathematics, and play an important role in probability theory Consider a sequence

More information

Data Structures. Algorithm Performance and Big O Analysis

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

More information

Algorithms. Margaret M. Fleck. 18 October 2010

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

More information

Random variables, probability distributions, binomial random variable

Random variables, probability distributions, binomial random variable Week 4 lecture notes. WEEK 4 page 1 Random variables, probability distributions, binomial random variable Eample 1 : Consider the eperiment of flipping a fair coin three times. The number of tails that

More information

CSC 180 H1F Algorithm Runtime Analysis Lecture Notes Fall 2015

CSC 180 H1F Algorithm Runtime Analysis Lecture Notes Fall 2015 1 Introduction These notes introduce basic runtime analysis of algorithms. We would like to be able to tell if a given algorithm is time-efficient, and to be able to compare different algorithms. 2 Linear

More information

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

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

More information

Applied Algorithm Design Lecture 5

Applied Algorithm Design Lecture 5 Applied Algorithm Design Lecture 5 Pietro Michiardi Eurecom Pietro Michiardi (Eurecom) Applied Algorithm Design Lecture 5 1 / 86 Approximation Algorithms Pietro Michiardi (Eurecom) Applied Algorithm Design

More information

The Running Time of Programs

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

More information

20 Selfish Load Balancing

20 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 information

Solutions of Equations in One Variable. Fixed-Point Iteration II

Solutions of Equations in One Variable. Fixed-Point Iteration II Solutions of Equations in One Variable Fixed-Point Iteration II Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University c 2011

More information

sin(x) < x sin(x) x < tan(x) sin(x) x cos(x) 1 < sin(x) sin(x) 1 < 1 cos(x) 1 cos(x) = 1 cos2 (x) 1 + cos(x) = sin2 (x) 1 < x 2

sin(x) < x sin(x) x < tan(x) sin(x) x cos(x) 1 < sin(x) sin(x) 1 < 1 cos(x) 1 cos(x) = 1 cos2 (x) 1 + cos(x) = sin2 (x) 1 < x 2 . Problem Show that using an ɛ δ proof. sin() lim = 0 Solution: One can see that the following inequalities are true for values close to zero, both positive and negative. This in turn implies that On the

More information

Mathematical Induction. Lecture 10-11

Mathematical Induction. Lecture 10-11 Mathematical Induction Lecture 10-11 Menu Mathematical Induction Strong Induction Recursive Definitions Structural Induction Climbing an Infinite Ladder Suppose we have an infinite ladder: 1. We can reach

More information

Jacobi s four squares identity Martin Klazar

Jacobi s four squares identity Martin Klazar Jacobi s four squares identity Martin Klazar (lecture on the 7-th PhD conference) Ostrava, September 10, 013 C. Jacobi [] in 189 proved that for any integer n 1, r (n) = #{(x 1, x, x 3, x ) Z ( i=1 x i

More information

A Turán Type Problem Concerning the Powers of the Degrees of a Graph

A Turán Type Problem Concerning the Powers of the Degrees of a Graph A Turán Type Problem Concerning the Powers of the Degrees of a Graph Yair Caro and Raphael Yuster Department of Mathematics University of Haifa-ORANIM, Tivon 36006, Israel. AMS Subject Classification:

More information

Lecture 4: BK inequality 27th August and 6th September, 2007

Lecture 4: BK inequality 27th August and 6th September, 2007 CSL866: Percolation and Random Graphs IIT Delhi Amitabha Bagchi Scribe: Arindam Pal Lecture 4: BK inequality 27th August and 6th September, 2007 4. Preliminaries The FKG inequality allows us to lower bound

More information

SECTION 10-5 Multiplication Principle, Permutations, and Combinations

SECTION 10-5 Multiplication Principle, Permutations, and Combinations 10-5 Multiplication Principle, Permutations, and Combinations 761 54. Can you guess what the next two rows in Pascal s triangle, shown at right, are? Compare the numbers in the triangle with the binomial

More information

BX in ( u, v) basis in two ways. On the one hand, AN = u+

BX in ( u, v) basis in two ways. On the one hand, AN = u+ 1. Let f(x) = 1 x +1. Find f (6) () (the value of the sixth derivative of the function f(x) at zero). Answer: 7. We expand the given function into a Taylor series at the point x = : f(x) = 1 x + x 4 x

More information

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

Question: What is the probability that a five-card poker hand contains a flush, that is, five cards of the same suit?

Question: What is the probability that a five-card poker hand contains a flush, that is, five cards of the same suit? ECS20 Discrete Mathematics Quarter: Spring 2007 Instructor: John Steinberger Assistant: Sophie Engle (prepared by Sophie Engle) Homework 8 Hints Due Wednesday June 6 th 2007 Section 6.1 #16 What is the

More information

Microeconomic Theory: Basic Math Concepts

Microeconomic Theory: Basic Math Concepts Microeconomic Theory: Basic Math Concepts Matt Van Essen University of Alabama Van Essen (U of A) Basic Math Concepts 1 / 66 Basic Math Concepts In this lecture we will review some basic mathematical concepts

More information

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

Algebra Unpacked Content For the new Common Core standards that will be effective in all North Carolina schools in the 2012-13 school year. This document is designed to help North Carolina educators teach the Common Core (Standard Course of Study). NCDPI staff are continually updating and improving these tools to better serve teachers. Algebra

More information

Corollary. (f є C n+1 [a,b]). Proof: This follows directly from the preceding theorem using the inequality

Corollary. (f є C n+1 [a,b]). Proof: This follows directly from the preceding theorem using the inequality Corollary For equidistant knots, i.e., u i = a + i (b-a)/n, we obtain with (f є C n+1 [a,b]). Proof: This follows directly from the preceding theorem using the inequality 120202: ESM4A - Numerical Methods

More information

U.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 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 information

Math 181 Handout 16. Rich Schwartz. March 9, 2010

Math 181 Handout 16. Rich Schwartz. March 9, 2010 Math 8 Handout 6 Rich Schwartz March 9, 200 The purpose of this handout is to describe continued fractions and their connection to hyperbolic geometry. The Gauss Map Given any x (0, ) we define γ(x) =

More information

6.042/18.062J Mathematics for Computer Science. Expected Value I

6.042/18.062J Mathematics for Computer Science. Expected Value I 6.42/8.62J Mathematics for Computer Science Srini Devadas and Eric Lehman May 3, 25 Lecture otes Expected Value I The expectation or expected value of a random variable is a single number that tells you

More information

recursion, O(n), linked lists 6/14

recursion, 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 information

Sums of Independent Random Variables

Sums of Independent Random Variables Chapter 7 Sums of Independent Random Variables 7.1 Sums of Discrete Random Variables In this chapter we turn to the important question of determining the distribution of a sum of independent random variables

More information

Sorting 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. 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 information

Sect 6.7 - Solving Equations Using the Zero Product Rule

Sect 6.7 - Solving Equations Using the Zero Product Rule Sect 6.7 - Solving Equations Using the Zero Product Rule 116 Concept #1: Definition of a Quadratic Equation A quadratic equation is an equation that can be written in the form ax 2 + bx + c = 0 (referred

More information

FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z

FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z DANIEL BIRMAJER, JUAN B GIL, AND MICHAEL WEINER Abstract We consider polynomials with integer coefficients and discuss their factorization

More information

www.mathsbox.org.uk ab = c a If the coefficients a,b and c are real then either α and β are real or α and β are complex conjugates

www.mathsbox.org.uk ab = c a If the coefficients a,b and c are real then either α and β are real or α and β are complex conjugates Further Pure Summary Notes. Roots of Quadratic Equations For a quadratic equation ax + bx + c = 0 with roots α and β Sum of the roots Product of roots a + b = b a ab = c a If the coefficients a,b and c

More information

Near Optimal Solutions

Near 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 information

Partial Fractions. p(x) q(x)

Partial Fractions. p(x) q(x) Partial Fractions Introduction to Partial Fractions Given a rational function of the form p(x) q(x) where the degree of p(x) is less than the degree of q(x), the method of partial fractions seeks to break

More information

Sample Induction Proofs

Sample Induction Proofs Math 3 Worksheet: Induction Proofs III, Sample Proofs A.J. Hildebrand Sample Induction Proofs Below are model solutions to some of the practice problems on the induction worksheets. The solutions given

More information

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

Representation of functions as power series

Representation of functions as power series Representation of functions as power series Dr. Philippe B. Laval Kennesaw State University November 9, 008 Abstract This document is a summary of the theory and techniques used to represent functions

More information

Course Notes for Math 162: Mathematical Statistics Approximation Methods in Statistics

Course Notes for Math 162: Mathematical Statistics Approximation Methods in Statistics Course Notes for Math 16: Mathematical Statistics Approximation Methods in Statistics Adam Merberg and Steven J. Miller August 18, 6 Abstract We introduce some of the approximation methods commonly used

More information

Algorithm Design and Analysis Homework #1 Due: 5pm, Friday, October 4, 2013 TA email: ada@csie.ntu.edu.tw. === Homework submission instructions ===

Algorithm Design and Analysis Homework #1 Due: 5pm, Friday, October 4, 2013 TA email: ada@csie.ntu.edu.tw. === Homework submission instructions === Algorithm Design and Analysis Homework #1 Due: 5pm, Friday, October 4, 2013 TA email: ada@csie.ntu.edu.tw === Homework submission instructions === For Problem 1, commit your source code and a brief documentation

More information

Course: Model, Learning, and Inference: Lecture 5

Course: Model, Learning, and Inference: Lecture 5 Course: Model, Learning, and Inference: Lecture 5 Alan Yuille Department of Statistics, UCLA Los Angeles, CA 90095 yuille@stat.ucla.edu Abstract Probability distributions on structured representation.

More information

An example of a computable

An example of a computable An example of a computable absolutely normal number Verónica Becher Santiago Figueira Abstract The first example of an absolutely normal number was given by Sierpinski in 96, twenty years before the concept

More information

13. Write the decimal approximation of 9,000,001 9,000,000, rounded to three significant

13. Write the decimal approximation of 9,000,001 9,000,000, rounded to three significant æ If 3 + 4 = x, then x = 2 gold bar is a rectangular solid measuring 2 3 4 It is melted down, and three equal cubes are constructed from this gold What is the length of a side of each cube? 3 What is the

More information

Solving Quadratic Equations

Solving Quadratic Equations 9.3 Solving Quadratic Equations by Using the Quadratic Formula 9.3 OBJECTIVES 1. Solve a quadratic equation by using the quadratic formula 2. Determine the nature of the solutions of a quadratic equation

More information

1 Short Introduction to Time Series

1 Short Introduction to Time Series ECONOMICS 7344, Spring 202 Bent E. Sørensen January 24, 202 Short Introduction to Time Series A time series is a collection of stochastic variables x,.., x t,.., x T indexed by an integer value t. The

More information

Chapter 11. 11.1 Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

Chapter 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 information

The sample space for a pair of die rolls is the set. The sample space for a random number between 0 and 1 is the interval [0, 1].

The sample space for a pair of die rolls is the set. The sample space for a random number between 0 and 1 is the interval [0, 1]. Probability Theory Probability Spaces and Events Consider a random experiment with several possible outcomes. For example, we might roll a pair of dice, flip a coin three times, or choose a random real

More information

Modern Algebra Lecture Notes: Rings and fields set 4 (Revision 2)

Modern Algebra Lecture Notes: Rings and fields set 4 (Revision 2) Modern Algebra Lecture Notes: Rings and fields set 4 (Revision 2) Kevin Broughan University of Waikato, Hamilton, New Zealand May 13, 2010 Remainder and Factor Theorem 15 Definition of factor If f (x)

More information

SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH

SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH 31 Kragujevac J. Math. 25 (2003) 31 49. SHARP BOUNDS FOR THE SUM OF THE SQUARES OF THE DEGREES OF A GRAPH Kinkar Ch. Das Department of Mathematics, Indian Institute of Technology, Kharagpur 721302, W.B.,

More information

IB Maths SL Sequence and Series Practice Problems Mr. W Name

IB Maths SL Sequence and Series Practice Problems Mr. W Name IB Maths SL Sequence and Series Practice Problems Mr. W Name Remember to show all necessary reasoning! Separate paper is probably best. 3b 3d is optional! 1. In an arithmetic sequence, u 1 = and u 3 =

More information

Wald s Identity. by Jeffery Hein. Dartmouth College, Math 100

Wald s Identity. by Jeffery Hein. Dartmouth College, Math 100 Wald s Identity by Jeffery Hein Dartmouth College, Math 100 1. Introduction Given random variables X 1, X 2, X 3,... with common finite mean and a stopping rule τ which may depend upon the given sequence,

More information

Asymptotics for a discrete-time risk model with Gamma-like insurance risks. Pokfulam Road, Hong Kong

Asymptotics for a discrete-time risk model with Gamma-like insurance risks. Pokfulam Road, Hong Kong Asymptotics for a discrete-time risk model with Gamma-like insurance risks Yang Yang 1,2 and Kam C. Yuen 3 1 Department of Statistics, Nanjing Audit University, Nanjing, 211815, China 2 School of Economics

More information

VERTICES OF GIVEN DEGREE IN SERIES-PARALLEL GRAPHS

VERTICES OF GIVEN DEGREE IN SERIES-PARALLEL GRAPHS VERTICES OF GIVEN DEGREE IN SERIES-PARALLEL GRAPHS MICHAEL DRMOTA, OMER GIMENEZ, AND MARC NOY Abstract. We show that the number of vertices of a given degree k in several kinds of series-parallel labelled

More information