Dynamic Programming. Sequence Of Decisions. 0/1 Knapsack Problem. Sequence Of Decisions

Size: px
Start display at page:

Download "Dynamic Programming. Sequence Of Decisions. 0/1 Knapsack Problem. Sequence Of Decisions"

Transcription

1 Dyamic Programmig Sequece Of Decisios Sequece of decisios. Problem state. Priciple of optimality. Dyamic Programmig Recurrece Equatios. Solutio of recurrece equatios. As i the greedy method, the solutio to a problem is viewed as the result of a sequece of decisios. Ulike the greedy method, decisios are ot made i a greedy ad bidig maer. 0/1 Kapsack Problem Let x i = 1 whe item i is selected ad let x i = 0 whe item i is ot selected. maximize p i x i i = 1 subject to w i x i <= c i = 1 ad x i = 0 or 1 for all i All profits ad weights are positive. Sequece Of Decisios Decide the x i values i the order x 1, x 2, x 3,, x. Decide the x i values i the order x, x -1, x -2,, x 1. Decide the x i values i the order x 1, x, x 2, x -1, Or ay other order.

2 Problem State The state of the 0/1 kapsack problem is give by ƒ the weights ad profits of the available items ƒ the capacity of the kapsack Whe a decisio o oe of the x i values is made, the problem state chages. ƒ item i is o loger available ƒ the remaiig kapsack capacity may be less Problem State Suppose that decisios are made i the order x 1, x 2, x 3,, x. The iitial state of the problem is described by the pair (1, c). ƒ Items 1 through are available (the weights, profits ad are implicit). ƒ The available kapsack capacity is c. Followig the first decisio the state becomes oe of the followig: ƒ (2, c) whe the decisio is to set x 1 = 0. ƒ (2, c-w 1 ) whe the decisio is to set x 1 = 1. Problem State Suppose that decisios are made i the order x, x -1, x -2,, x 1. The iitial state of the problem is described by the pair (, c). ƒ Items 1 through are available (the weights, profits ad first item idex are implicit). ƒ The available kapsack capacity is c. Followig the first decisio the state becomes oe of the followig: ƒ (-1, c) whe the decisio is to set x = 0. ƒ (-1, c-w ) whe the decisio is to set x = 1. Priciple Of Optimality A optimal solutio satisfies the followig property: ƒ No matter what the first decisio, the remaiig decisios are optimal with respect to the state that results from this decisio. Dyamic programmig may be used oly whe the priciple of optimality holds.

3 0/1 Kapsack Problem Suppose that decisios are made i the order x 1, x 2, x 3,, x. Let x 1 = a 1, x 2 = a 2, x 3 = a 3,, x = a be a optimal solutio. If a 1 = 0, the followig the first decisio the state is (2, c). a 2, a 3,, a must be a optimal solutio to the kapsack istace give by the state (2,c). x 1 = a 1 = 0 maximize p i x i subject to w i x i <= c ad x i = 0 or 1 for all i If ot, this istace has a better solutio b 2, b 3,, b. p i b i > p i a i x 1 = a 1 = 0 x 1 = a 1 = 1 x 1 = a 1, x 2 = b 2, x 3 = b 3,, x = b is a better solutio to the origial istace tha is x 1 = a 1, x 2 = a 2, x 3 = a 3,, x = a. So x 1 = a 1, x 2 = a 2, x 3 = a 3,, x = a caot be a optimal solutio a cotradictio with the assumptio that it is optimal. Next, cosider the case a 1 = 1. Followig the first decisio the state is (2, c-w 1 ). a 2, a 3,, a must be a optimal solutio to the kapsack istace give by the state (2,c -w 1 ).

4 x 1 = a 1 = 1 maximize p i x i subject to w i x i <= c- w 1 ad x i = 0 or 1 for all i x 1 = a 1 = 1 x 1 = a 1, x 2 = b 2, x 3 = b 3,, x = b is a better solutio to the origial istace tha is x 1 = a 1, x 2 = a 2, x 3 = a 3,, x = a. So x 1 = a 1, x 2 = a 2, x 3 = a 3,, x = a caot be a optimal solutio a cotradictio with the assumptio that it is optimal. If ot, this istace has a better solutio b 2, b 3,, b. p i b i > p i a i 0/1 Kapsack Problem Therefore, o matter what the first decisio, the remaiig decisios are optimal with respect to the state that results from this decisio. The priciple of optimality holds ad dyamic programmig may be applied. Dyamic Programmig Recurrece Let f(i,y) be the profit value of the optimal solutio to the kapsack istace defied by the state (i,y). ƒ Items i through are available. ƒ Available capacity is y. For the time beig assume that we wish to determie oly the value of the best solutio. ƒ Later we will worry about determiig the x i s that yield this maximum value. Uder this assumptio, our task is to determie f(1,c).

5 Dyamic Programmig Recurrece f(,y) is the value of the optimal solutio to the kapsack istace defied by the state (,y). ƒ Oly item is available. ƒ Available capacity is y. If w <= y, f(,y) = p. If w > y, f(,y) = 0. Dyamic Programmig Recurrece Suppose that i <. f(i,y) is the value of the optimal solutio to the kapsack istace defied by the state (i,y). ƒ Items i through are available. ƒ Available capacity is y. Suppose that i the optimal solutio for the state (i,y), the first decisio is to set x i = 0. From the priciple of optimality (we have show that this priciple holds for the kapsack problem), it follows that f(i,y) = f(i+1,y). Dyamic Programmig Recurrece The oly other possibility for the first decisio is x i = 1. The case x i = 1 ca arise oly whe y >= w i. From the priciple of optimality, it follows that f(i,y) = f(i+1,y-w i ) + p i. Combiig the two cases, we get ƒ f(i,y) = f(i+1,y) wheever y < w i. ƒ f(i,y) = max{f(i+1,y), f(i+1,y-w i ) + p i }, y >= w i. Recursive Code f(i,y) */ private static it f(it i, it y) { if (i == ) retur (y < w[])? 0 : p[]; if (y < w[i]) retur f(i + 1, y); retur Math.max(f(i + 1, y), f(i + 1, y - w[i]) + p[i]); }

6 Recursio Tree f(1,c) f(2,c) f(2,c-w 1 ) f(3,c) f(3,c-w 2 ) f(3,c-w 1 ) f(3,c-w 1 w 2 ) f(4,c) f(4,c-w 3 ) f(4,c-w 2 ) f(4,c-w 1 w 3 ) Time Complexity Let t() be the time required whe items are available. t(0) = t(1) = a, where a is a costat. Whe t > 1, t() <= 2t(-1) + b, where b is a costat. t() = O(2 ). f(5,c) f(5,c-w 1 w 3 w 4 ) Solvig dyamic programmig recurreces recursively ca be hazardous to ru time. Reducig Ru Time f(1,c) f(2,c) f(2,c-w 1 ) f(3,c) f(3,c-w 2 ) f(3,c-w 1 ) f(3,c-w 1 w 2 ) f(4,c) f(4,c-w 3 ) f(4,c-w 2 ) f(4,c-w 1 w 3 ) f(5,c) f(5,c-w 1 w 3 w 4 ) Time Complexity Level i of the recursio tree has up to 2 i-1 odes. At each such ode a f(i,y) is computed. Several odes may compute the same f(i,y). We ca save time by ot recomputig already computed f(i,y)s. Save computed f(i,y)s i a dictioary. ƒ Key is (i, y) value. ƒ f(i, y) is computed recursively oly whe (i,y) is ot i the dictioary. ƒ Otherwise, the dictioary value is used.

7 Iteger Weights Iteger Weights Dictioary Assume that each weight is a iteger. The kapsack capacity c may also be assumed to be a iteger. Oly f(i,y)s with 1 <= i <= ad 0 <= y <= c are of iterest. Eve though level i of the recursio tree has up to 2 i-1 odes, at most c+1 represet differet f(i,y)s. Use a array farray[][] as the dictioary. farray[1:][0:c] farray[i][y] = -1 iff f(i,y) ot yet computed. This iitializatio is doe before the recursive method is ivoked. The iitializatio takes O(c) time. No Recomputatio Code private static it f(it i, it y) { if (farray[i][y] >= 0) retur farray[i][y]; if (i == ) {farray[i][y] = (y < w[])? 0 : p[]; retur farray[i][y];} if (y < w[i]) farray[i][y] = f(i + 1, y); else farray[i][y] = Math.max(f(i + 1, y), f(i + 1, y - w[i]) + p[i]); retur farray[i][y]; } Time Complexity t() = O(c). Aalysis doe i text. Good whe c is small relative to 2. = 3, c = w = [100102, , 6327] p = [102, 505, 5] 2 = 8 c =

Dynamic Programming. Sequence Of Decisions

Dynamic Programming. Sequence Of Decisions Dyamic Programmig Sequece of decisios. Problem state. Priciple of optimality. Dyamic Programmig Recurrece Equatios. Solutio of recurrece equatios. Sequece Of Decisios As i the greedy method, the solutio

More information

Test One (Answer Key)

Test One (Answer Key) CS395/Ma395 (Sprig 2005) Test Oe Name: Page 1 Test Oe (Aswer Key) CS395/Ma395: Aalysis of Algorithms This is a closed book, closed otes, 70 miute examiatio. It is worth 100 poits. There are twelve (12)

More information

Sequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018

Sequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018 CSE 353 Discrete Computatioal Structures Sprig 08 Sequeces, Mathematical Iductio, ad Recursio (Chapter 5, Epp) Note: some course slides adopted from publisher-provided material Overview May mathematical

More information

Recurrence Relations

Recurrence Relations Recurrece Relatios Aalysis of recursive algorithms, such as: it factorial (it ) { if (==0) retur ; else retur ( * factorial(-)); } Let t be the umber of multiplicatios eeded to calculate factorial(). The

More information

Recursive Algorithms. Recurrences. Recursive Algorithms Analysis

Recursive Algorithms. Recurrences. Recursive Algorithms Analysis Recursive Algorithms Recurreces Computer Sciece & Egieerig 35: Discrete Mathematics Christopher M Bourke cbourke@cseuledu A recursive algorithm is oe i which objects are defied i terms of other objects

More information

Chapter 4. Fourier Series

Chapter 4. Fourier Series Chapter 4. Fourier Series At this poit we are ready to ow cosider the caoical equatios. Cosider, for eample the heat equatio u t = u, < (4.) subject to u(, ) = si, u(, t) = u(, t) =. (4.) Here,

More information

4.3 Growth Rates of Solutions to Recurrences

4.3 Growth Rates of Solutions to Recurrences 4.3. GROWTH RATES OF SOLUTIONS TO RECURRENCES 81 4.3 Growth Rates of Solutios to Recurreces 4.3.1 Divide ad Coquer Algorithms Oe of the most basic ad powerful algorithmic techiques is divide ad coquer.

More information

OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES

OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES OPTIMAL ALGORITHMS -- SUPPLEMENTAL NOTES Peter M. Maurer Why Hashig is θ(). As i biary search, hashig assumes that keys are stored i a array which is idexed by a iteger. However, hashig attempts to bypass

More information

w (1) ˆx w (1) x (1) /ρ and w (2) ˆx w (2) x (2) /ρ.

w (1) ˆx w (1) x (1) /ρ and w (2) ˆx w (2) x (2) /ρ. 2 5. Weighted umber of late jobs 5.1. Release dates ad due dates: maximimizig the weight of o-time jobs Oce we add release dates, miimizig the umber of late jobs becomes a sigificatly harder problem. For

More information

and each factor on the right is clearly greater than 1. which is a contradiction, so n must be prime.

and each factor on the right is clearly greater than 1. which is a contradiction, so n must be prime. MATH 324 Summer 200 Elemetary Number Theory Solutios to Assigmet 2 Due: Wedesday July 2, 200 Questio [p 74 #6] Show that o iteger of the form 3 + is a prime, other tha 2 = 3 + Solutio: If 3 + is a prime,

More information

Average-Case Analysis of QuickSort

Average-Case Analysis of QuickSort Average-Case Aalysis of QuickSort Comp 363 Fall Semester 003 October 3, 003 The purpose of this documet is to itroduce the idea of usig recurrece relatios to do average-case aalysis. The average-case ruig

More information

A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence Sequeces A sequece of umbers is a fuctio whose domai is the positive itegers. We ca see that the sequece,, 2, 2, 3, 3,... is a fuctio from the positive itegers whe we write the first sequece elemet as

More information

Markov Decision Processes

Markov Decision Processes Markov Decisio Processes Defiitios; Statioary policies; Value improvemet algorithm, Policy improvemet algorithm, ad liear programmig for discouted cost ad average cost criteria. Markov Decisio Processes

More information

CS583 Lecture 02. Jana Kosecka. some materials here are based on E. Demaine, D. Luebke slides

CS583 Lecture 02. Jana Kosecka. some materials here are based on E. Demaine, D. Luebke slides CS583 Lecture 02 Jaa Kosecka some materials here are based o E. Demaie, D. Luebke slides Previously Sample algorithms Exact ruig time, pseudo-code Approximate ruig time Worst case aalysis Best case aalysis

More information

CS / MCS 401 Homework 3 grader solutions

CS / MCS 401 Homework 3 grader solutions CS / MCS 401 Homework 3 grader solutios assigmet due July 6, 016 writte by Jāis Lazovskis maximum poits: 33 Some questios from CLRS. Questios marked with a asterisk were ot graded. 1 Use the defiitio of

More information

Sequences A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

Sequences A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence Sequeces A sequece of umbers is a fuctio whose domai is the positive itegers. We ca see that the sequece 1, 1, 2, 2, 3, 3,... is a fuctio from the positive itegers whe we write the first sequece elemet

More information

Sorting Algorithms. Algorithms Kyuseok Shim SoEECS, SNU.

Sorting Algorithms. Algorithms Kyuseok Shim SoEECS, SNU. Sortig Algorithms Algorithms Kyuseo Shim SoEECS, SNU. Desigig Algorithms Icremetal approaches Divide-ad-Coquer approaches Dyamic programmig approaches Greedy approaches Radomized approaches You are ot

More information

CSE 4095/5095 Topics in Big Data Analytics Spring 2017; Homework 1 Solutions

CSE 4095/5095 Topics in Big Data Analytics Spring 2017; Homework 1 Solutions CSE 09/09 Topics i ig Data Aalytics Sprig 2017; Homework 1 Solutios Note: Solutios to problems,, ad 6 are due to Marius Nicolae. 1. Cosider the followig algorithm: for i := 1 to α log e do Pick a radom

More information

Different kinds of Mathematical Induction

Different kinds of Mathematical Induction Differet ids of Mathematical Iductio () Mathematical Iductio Give A N, [ A (a A a A)] A N () (First) Priciple of Mathematical Iductio Let P() be a propositio (ope setece), if we put A { : N p() is true}

More information

Solutions for the Exam 9 January 2012

Solutions for the Exam 9 January 2012 Mastermath ad LNMB Course: Discrete Optimizatio Solutios for the Exam 9 Jauary 2012 Utrecht Uiversity, Educatorium, 15:15 18:15 The examiatio lasts 3 hours. Gradig will be doe before Jauary 23, 2012. Studets

More information

Optimally Sparse SVMs

Optimally Sparse SVMs A. Proof of Lemma 3. We here prove a lower boud o the umber of support vectors to achieve geeralizatio bouds of the form which we cosider. Importatly, this result holds ot oly for liear classifiers, but

More information

This Lecture. Divide and Conquer. Merge Sort: Algorithm. Merge Sort Algorithm. MergeSort (Example) - 1. MergeSort (Example) - 2

This Lecture. Divide and Conquer. Merge Sort: Algorithm. Merge Sort Algorithm. MergeSort (Example) - 1. MergeSort (Example) - 2 This Lecture Divide-ad-coquer techique for algorithm desig. Example the merge sort. Writig ad solvig recurreces Divide ad Coquer Divide-ad-coquer method for algorithm desig: Divide: If the iput size is

More information

A New Solution Method for the Finite-Horizon Discrete-Time EOQ Problem

A New Solution Method for the Finite-Horizon Discrete-Time EOQ Problem This is the Pre-Published Versio. A New Solutio Method for the Fiite-Horizo Discrete-Time EOQ Problem Chug-Lu Li Departmet of Logistics The Hog Kog Polytechic Uiversity Hug Hom, Kowloo, Hog Kog Phoe: +852-2766-7410

More information

Sums, products and sequences

Sums, products and sequences Sums, products ad sequeces How to write log sums, e.g., 1+2+ (-1)+ cocisely? i=1 Sum otatio ( sum from 1 to ): i 3 = 1 + 2 + + If =3, i=1 i = 1+2+3=6. The ame ii does ot matter. Could use aother letter

More information

subject to A 1 x + A 2 y b x j 0, j = 1,,n 1 y j = 0 or 1, j = 1,,n 2

subject to A 1 x + A 2 y b x j 0, j = 1,,n 1 y j = 0 or 1, j = 1,,n 2 Additioal Brach ad Boud Algorithms 0-1 Mixed-Iteger Liear Programmig The brach ad boud algorithm described i the previous sectios ca be used to solve virtually all optimizatio problems cotaiig iteger variables,

More information

Lecture 3: Asymptotic Analysis + Recurrences

Lecture 3: Asymptotic Analysis + Recurrences Lecture 3: Asymptotic Aalysis + Recurreces Data Structures ad Algorithms CSE 373 SU 18 BEN JONES 1 Warmup Write a model ad fid Big-O for (it i = 0; i < ; i++) { for (it j = 0; j < i; j++) { System.out.pritl(

More information

CHAPTER 10 INFINITE SEQUENCES AND SERIES

CHAPTER 10 INFINITE SEQUENCES AND SERIES CHAPTER 10 INFINITE SEQUENCES AND SERIES 10.1 Sequeces 10.2 Ifiite Series 10.3 The Itegral Tests 10.4 Compariso Tests 10.5 The Ratio ad Root Tests 10.6 Alteratig Series: Absolute ad Coditioal Covergece

More information

Analytic Continuation

Analytic Continuation Aalytic Cotiuatio The stadard example of this is give by Example Let h (z) = 1 + z + z 2 + z 3 +... kow to coverge oly for z < 1. I fact h (z) = 1/ (1 z) for such z. Yet H (z) = 1/ (1 z) is defied for

More information

Section 1.1. Calculus: Areas And Tangents. Difference Equations to Differential Equations

Section 1.1. Calculus: Areas And Tangents. Difference Equations to Differential Equations Differece Equatios to Differetial Equatios Sectio. Calculus: Areas Ad Tagets The study of calculus begis with questios about chage. What happes to the velocity of a swigig pedulum as its positio chages?

More information

Read carefully the instructions on the answer book and make sure that the particulars required are entered on each answer book.

Read carefully the instructions on the answer book and make sure that the particulars required are entered on each answer book. THE UNIVERSITY OF WARWICK FIRST YEAR EXAMINATION: Jauary 2009 Aalysis I Time Allowed:.5 hours Read carefully the istructios o the aswer book ad make sure that the particulars required are etered o each

More information

A MATHEMATICA PACKAGE FOR COMPUTING ASYMPTOTIC EXPANSIONS OF SOLUTIONS OF P-FINITE RECURRENCE EQUATIONS. 1. The Problem

A MATHEMATICA PACKAGE FOR COMPUTING ASYMPTOTIC EXPANSIONS OF SOLUTIONS OF P-FINITE RECURRENCE EQUATIONS. 1. The Problem A MATHEMATICA PACKAGE FOR COMPUTING ASYMPTOTIC EXPANSIONS OF SOLUTIONS OF P-FINITE RECURRENCE EQUATIONS MANUEL KAUERS Abstract. We describe a simple package for computig a fudametal system of certai formal

More information

Ch3. Asymptotic Notation

Ch3. Asymptotic Notation Ch. Asymptotic Notatio copyright 006 Preview of Chapters Chapter How to aalyze the space ad time complexities of program Chapter Review asymptotic otatios such as O, Ω, Θ, o for simplifyig the aalysis

More information

Chapter 6. Advanced Counting Techniques

Chapter 6. Advanced Counting Techniques Chapter 6 Advaced Coutig Techiques 6.: Recurrece Relatios Defiitio: A recurrece relatio for the sequece {a } is a equatio expressig a i terms of oe or more of the previous terms of the sequece: a,a2,a3,,a

More information

Model of Computation and Runtime Analysis

Model of Computation and Runtime Analysis Model of Computatio ad Rutime Aalysis Model of Computatio Model of Computatio Specifies Set of operatios Cost of operatios (ot ecessarily time) Examples Turig Machie Radom Access Machie (RAM) PRAM Map

More information

Fundamental Algorithms

Fundamental Algorithms Fudametal Algorithms Chapter 2b: Recurreces Michael Bader Witer 2014/15 Chapter 2b: Recurreces, Witer 2014/15 1 Recurreces Defiitio A recurrece is a (i-equality that defies (or characterizes a fuctio i

More information

Linear Programming and the Simplex Method

Linear Programming and the Simplex Method Liear Programmig ad the Simplex ethod Abstract This article is a itroductio to Liear Programmig ad usig Simplex method for solvig LP problems i primal form. What is Liear Programmig? Liear Programmig is

More information

Classification of problem & problem solving strategies. classification of time complexities (linear, logarithmic etc)

Classification of problem & problem solving strategies. classification of time complexities (linear, logarithmic etc) Classificatio of problem & problem solvig strategies classificatio of time complexities (liear, arithmic etc) Problem subdivisio Divide ad Coquer strategy. Asymptotic otatios, lower boud ad upper boud:

More information

Langford s Problem. Moti Ben-Ari. Department of Science Teaching. Weizmann Institute of Science.

Langford s Problem. Moti Ben-Ari. Department of Science Teaching. Weizmann Institute of Science. Lagford s Problem Moti Be-Ari Departmet of Sciece Teachig Weizma Istitute of Sciece http://www.weizma.ac.il/sci-tea/beari/ c 017 by Moti Be-Ari. This work is licesed uder the Creative Commos Attributio-ShareAlike

More information

Model of Computation and Runtime Analysis

Model of Computation and Runtime Analysis Model of Computatio ad Rutime Aalysis Model of Computatio Model of Computatio Specifies Set of operatios Cost of operatios (ot ecessarily time) Examples Turig Machie Radom Access Machie (RAM) PRAM Map

More information

2.4 - Sequences and Series

2.4 - Sequences and Series 2.4 - Sequeces ad Series Sequeces A sequece is a ordered list of elemets. Defiitio 1 A sequece is a fuctio from a subset of the set of itegers (usually either the set 80, 1, 2, 3,... < or the set 81, 2,

More information

Department of Informatics Prof. Dr. Michael Böhlen Binzmühlestrasse Zurich Phone:

Department of Informatics Prof. Dr. Michael Böhlen Binzmühlestrasse Zurich Phone: Departmet of Iformatics Prof. Dr. Michael Böhle Bizmühlestrasse 14 8050 Zurich Phoe: +41 44 635 4333 Email: boehle@ifi.uzh.ch Iformatik II Midterm1 Sprig 018 3.03.018 Advice You have 90 miutes to complete

More information

Unit 6: Sequences and Series

Unit 6: Sequences and Series AMHS Hoors Algebra 2 - Uit 6 Uit 6: Sequeces ad Series 26 Sequeces Defiitio: A sequece is a ordered list of umbers ad is formally defied as a fuctio whose domai is the set of positive itegers. It is commo

More information

CSE 202 Homework 1 Matthias Springer, A Yes, there does always exist a perfect matching without a strong instability.

CSE 202 Homework 1 Matthias Springer, A Yes, there does always exist a perfect matching without a strong instability. CSE 0 Homework 1 Matthias Spriger, A9950078 1 Problem 1 Notatio a b meas that a is matched to b. a < b c meas that b likes c more tha a. Equality idicates a tie. Strog istability Yes, there does always

More information

Find a formula for the exponential function whose graph is given , 1 2,16 1, 6

Find a formula for the exponential function whose graph is given , 1 2,16 1, 6 Math 4 Activity (Due by EOC Apr. ) Graph the followig epoetial fuctios by modifyig the graph of f. Fid the rage of each fuctio.. g. g. g 4. g. g 6. g Fid a formula for the epoetial fuctio whose graph is

More information

Hoggatt and King [lo] defined a complete sequence of natural numbers

Hoggatt and King [lo] defined a complete sequence of natural numbers REPRESENTATIONS OF N AS A SUM OF DISTINCT ELEMENTS FROM SPECIAL SEQUENCES DAVID A. KLARNER, Uiversity of Alberta, Edmoto, Caada 1. INTRODUCTION Let a, I deote a sequece of atural umbers which satisfies

More information

Math 2112 Solutions Assignment 5

Math 2112 Solutions Assignment 5 Math 2112 Solutios Assigmet 5 5.1.1 Idicate which of the followig relatioships are true ad which are false: a. Z Q b. R Q c. Q Z d. Z Z Z e. Q R Q f. Q Z Q g. Z R Z h. Z Q Z a. True. Every positive iteger

More information

CS 270 Algorithms. Oliver Kullmann. Growth of Functions. Divide-and- Conquer Min-Max- Problem. Tutorial. Reading from CLRS for week 2

CS 270 Algorithms. Oliver Kullmann. Growth of Functions. Divide-and- Conquer Min-Max- Problem. Tutorial. Reading from CLRS for week 2 Geeral remarks Week 2 1 Divide ad First we cosider a importat tool for the aalysis of algorithms: Big-Oh. The we itroduce a importat algorithmic paradigm:. We coclude by presetig ad aalysig two examples.

More information

MATH 324 Summer 2006 Elementary Number Theory Solutions to Assignment 2 Due: Thursday July 27, 2006

MATH 324 Summer 2006 Elementary Number Theory Solutions to Assignment 2 Due: Thursday July 27, 2006 MATH 34 Summer 006 Elemetary Number Theory Solutios to Assigmet Due: Thursday July 7, 006 Departmet of Mathematical ad Statistical Scieces Uiversity of Alberta Questio [p 74 #6] Show that o iteger of the

More information

Math 140A Elementary Analysis Homework Questions 1

Math 140A Elementary Analysis Homework Questions 1 Math 14A Elemetary Aalysis Homewor Questios 1 1 Itroductio 1.1 The Set N of Natural Numbers 1 Prove that 1 2 2 2 2 1 ( 1(2 1 for all atural umbers. 2 Prove that 3 11 (8 5 4 2 for all N. 4 (a Guess a formula

More information

Data Structures Lecture 9

Data Structures Lecture 9 Fall 2017 Fag Yu Software Security Lab. Dept. Maagemet Iformatio Systems, Natioal Chegchi Uiversity Data Structures Lecture 9 Midterm o Dec. 7 (9:10-12:00am, 106) Lec 1-9, TextBook Ch1-8, 11,12 How to

More information

Merge and Quick Sort

Merge and Quick Sort Merge ad Quick Sort Merge Sort Merge Sort Tree Implemetatio Quick Sort Pivot Item Radomized Quick Sort Adapted from: Goodrich ad Tamassia, Data Structures ad Algorithms i Java, Joh Wiley & So (1998). Ruig

More information

Iterative Techniques for Solving Ax b -(3.8). Assume that the system has a unique solution. Let x be the solution. Then x A 1 b.

Iterative Techniques for Solving Ax b -(3.8). Assume that the system has a unique solution. Let x be the solution. Then x A 1 b. Iterative Techiques for Solvig Ax b -(8) Cosider solvig liear systems of them form: Ax b where A a ij, x x i, b b i Assume that the system has a uique solutio Let x be the solutio The x A b Jacobi ad Gauss-Seidel

More information

Mathematical Foundation. CSE 6331 Algorithms Steve Lai

Mathematical Foundation. CSE 6331 Algorithms Steve Lai Mathematical Foudatio CSE 6331 Algorithms Steve Lai Complexity of Algorithms Aalysis of algorithm: to predict the ruig time required by a algorithm. Elemetary operatios: arithmetic & boolea operatios:

More information

CSI 2101 Discrete Structures Winter Homework Assignment #4 (100 points, weight 5%) Due: Thursday, April 5, at 1:00pm (in lecture)

CSI 2101 Discrete Structures Winter Homework Assignment #4 (100 points, weight 5%) Due: Thursday, April 5, at 1:00pm (in lecture) CSI 101 Discrete Structures Witer 01 Prof. Lucia Moura Uiversity of Ottawa Homework Assigmet #4 (100 poits, weight %) Due: Thursday, April, at 1:00pm (i lecture) Program verificatio, Recurrece Relatios

More information

Integer Programming (IP)

Integer Programming (IP) Iteger Programmig (IP) The geeral liear mathematical programmig problem where Mied IP Problem - MIP ma c T + h Z T y A + G y + y b R p + vector of positive iteger variables y vector of positive real variables

More information

Optimization Methods MIT 2.098/6.255/ Final exam

Optimization Methods MIT 2.098/6.255/ Final exam Optimizatio Methods MIT 2.098/6.255/15.093 Fial exam Date Give: December 19th, 2006 P1. [30 pts] Classify the followig statemets as true or false. All aswers must be well-justified, either through a short

More information

RADICAL EXPRESSION. If a and x are real numbers and n is a positive integer, then x is an. n th root theorems: Example 1 Simplify

RADICAL EXPRESSION. If a and x are real numbers and n is a positive integer, then x is an. n th root theorems: Example 1 Simplify Example 1 Simplify 1.2A Radical Operatios a) 4 2 b) 16 1 2 c) 16 d) 2 e) 8 1 f) 8 What is the relatioship betwee a, b, c? What is the relatioship betwee d, e, f? If x = a, the x = = th root theorems: RADICAL

More information

Math 475, Problem Set #12: Answers

Math 475, Problem Set #12: Answers Math 475, Problem Set #12: Aswers A. Chapter 8, problem 12, parts (b) ad (d). (b) S # (, 2) = 2 2, sice, from amog the 2 ways of puttig elemets ito 2 distiguishable boxes, exactly 2 of them result i oe

More information

Divide & Conquer. Divide-and-conquer algorithms. Conventional product of polynomials. Conventional product of polynomials.

Divide & Conquer. Divide-and-conquer algorithms. Conventional product of polynomials. Conventional product of polynomials. Divide-ad-coquer algorithms Divide & Coquer Strategy: Divide the problem ito smaller subproblems of the same type of problem Solve the subproblems recursively Combie the aswers to solve the origial problem

More information

Massachusetts Institute of Technology

Massachusetts Institute of Technology 6.0/6.3: Probabilistic Systems Aalysis (Fall 00) Problem Set 8: Solutios. (a) We cosider a Markov chai with states 0,,, 3,, 5, where state i idicates that there are i shoes available at the frot door i

More information

Matriculation number: You have 90 minutes to complete the exam of InformatikIIb. The following rules apply:

Matriculation number: You have 90 minutes to complete the exam of InformatikIIb. The following rules apply: Departmet of Iformatics Prof. Dr. Michael Böhle Bizmühlestrasse 14 8050 Zurich Phoe: +41 44 635 4333 Email: boehle@ifi.uzh.ch AlgoDat Midterm1 Sprig 016 08.04.016 Name: Matriculatio umber: Advice You have

More information

(A sequence also can be thought of as the list of function values attained for a function f :ℵ X, where f (n) = x n for n 1.) x 1 x N +k x N +4 x 3

(A sequence also can be thought of as the list of function values attained for a function f :ℵ X, where f (n) = x n for n 1.) x 1 x N +k x N +4 x 3 MATH 337 Sequeces Dr. Neal, WKU Let X be a metric space with distace fuctio d. We shall defie the geeral cocept of sequece ad limit i a metric space, the apply the results i particular to some special

More information

Math 155 (Lecture 3)

Math 155 (Lecture 3) Math 55 (Lecture 3) September 8, I this lecture, we ll cosider the aswer to oe of the most basic coutig problems i combiatorics Questio How may ways are there to choose a -elemet subset of the set {,,,

More information

IP Reference guide for integer programming formulations.

IP Reference guide for integer programming formulations. IP Referece guide for iteger programmig formulatios. by James B. Orli for 15.053 ad 15.058 This documet is iteded as a compact (or relatively compact) guide to the formulatio of iteger programs. For more

More information

Seunghee Ye Ma 8: Week 5 Oct 28

Seunghee Ye Ma 8: Week 5 Oct 28 Week 5 Summary I Sectio, we go over the Mea Value Theorem ad its applicatios. I Sectio 2, we will recap what we have covered so far this term. Topics Page Mea Value Theorem. Applicatios of the Mea Value

More information

LINEAR RECURSION RELATIONS - LESSON FOUR SECOND-ORDER LINEAR RECURSION RELATIONS

LINEAR RECURSION RELATIONS - LESSON FOUR SECOND-ORDER LINEAR RECURSION RELATIONS LINEAR RECURSION RELATIONS - LESSON FOUR SECOND-ORDER LINEAR RECURSION RELATIONS BROTHER ALFRED BROUSSEAU St. Mary's College, Califoria Give a secod-order liear recursio relatio (.1) T. 1 = a T + b T 1,

More information

5. Solving recurrences

5. Solving recurrences 5. Solvig recurreces Time Complexity Alysis of Merge Sort T( ) 0 if 1 2T ( / 2) otherwise sortig oth hlves mergig Q. How to prove tht the ru-time of merge sort is O( )? A. 2 Time Complexity Alysis of Merge

More information

a 2 +b 2 +c 2 ab+bc+ca.

a 2 +b 2 +c 2 ab+bc+ca. All Problems o the Prize Exams Sprig 205 The source for each problem is listed below whe available; but eve whe the source is give, the formulatio of the problem may have bee chaged. Solutios for the problems

More information

[ 47 ] then T ( m ) is true for all n a. 2. The greatest integer function : [ ] is defined by selling [ x]

[ 47 ] then T ( m ) is true for all n a. 2. The greatest integer function : [ ] is defined by selling [ x] [ 47 ] Number System 1. Itroductio Pricile : Let { T ( ) : N} be a set of statemets, oe for each atural umber. If (i), T ( a ) is true for some a N ad (ii) T ( k ) is true imlies T ( k 1) is true for all

More information

) n. ALG 1.3 Deterministic Selection and Sorting: Problem P size n. Examples: 1st lecture's mult M(n) = 3 M ( È

) n. ALG 1.3 Deterministic Selection and Sorting: Problem P size n. Examples: 1st lecture's mult M(n) = 3 M ( È Algorithms Professor Joh Reif ALG 1.3 Determiistic Selectio ad Sortig: (a) Selectio Algorithms ad Lower Bouds (b) Sortig Algorithms ad Lower Bouds Problem P size fi divide ito subproblems size 1,..., k

More information

TEACHER CERTIFICATION STUDY GUIDE

TEACHER CERTIFICATION STUDY GUIDE COMPETENCY 1. ALGEBRA SKILL 1.1 1.1a. ALGEBRAIC STRUCTURES Kow why the real ad complex umbers are each a field, ad that particular rigs are ot fields (e.g., itegers, polyomial rigs, matrix rigs) Algebra

More information

Principle Of Superposition

Principle Of Superposition ecture 5: PREIMINRY CONCEP O RUCUR NYI Priciple Of uperpositio Mathematically, the priciple of superpositio is stated as ( a ) G( a ) G( ) G a a or for a liear structural system, the respose at a give

More information

V. Adamchik 1. Recursions. Victor Adamchik Fall of x n1. x n 2. Here are a few first values of the above sequence (coded in Mathematica)

V. Adamchik 1. Recursions. Victor Adamchik Fall of x n1. x n 2. Here are a few first values of the above sequence (coded in Mathematica) V. Adamchik Recursios Victor Adamchik Fall of 2005 Pla. Covergece of sequeces 2. Fractals 3. Coutig biary trees Covergece of Sequeces I the previous lecture we cosidered a cotiued fractio for 2 : 2 This

More information

It is often useful to approximate complicated functions using simpler ones. We consider the task of approximating a function by a polynomial.

It is often useful to approximate complicated functions using simpler ones. We consider the task of approximating a function by a polynomial. Taylor Polyomials ad Taylor Series It is ofte useful to approximate complicated fuctios usig simpler oes We cosider the task of approximatig a fuctio by a polyomial If f is at least -times differetiable

More information

1. Introduction. Notice that we have taken the terms of the harmonic series, and subtracted them from

1. Introduction. Notice that we have taken the terms of the harmonic series, and subtracted them from 06/5/00 EAANGING TEM O A HAMONIC-LIKE EIE Mathematics ad Computer Educatio, 35(00), pp 36-39 Thomas J Osler Mathematics Departmet owa Uiversity Glassboro, NJ 0808 osler@rowaedu Itroductio The commutative

More information

Homework 2. Show that if h is a bounded sesquilinear form on the Hilbert spaces X and Y, then h has the representation

Homework 2. Show that if h is a bounded sesquilinear form on the Hilbert spaces X and Y, then h has the representation omework 2 1 Let X ad Y be ilbert spaces over C The a sesquiliear form h o X Y is a mappig h : X Y C such that for all x 1, x 2, x X, y 1, y 2, y Y ad all scalars α, β C we have (a) h(x 1 + x 2, y) h(x

More information

MA131 - Analysis 1. Workbook 3 Sequences II

MA131 - Analysis 1. Workbook 3 Sequences II MA3 - Aalysis Workbook 3 Sequeces II Autum 2004 Cotets 2.8 Coverget Sequeces........................ 2.9 Algebra of Limits......................... 2 2.0 Further Useful Results........................

More information

Recursive Algorithm for Generating Partitions of an Integer. 1 Preliminary

Recursive Algorithm for Generating Partitions of an Integer. 1 Preliminary Recursive Algorithm for Geeratig Partitios of a Iteger Sug-Hyuk Cha Computer Sciece Departmet, Pace Uiversity 1 Pace Plaza, New York, NY 10038 USA scha@pace.edu Abstract. This article first reviews the

More information

Chapter 22 Developing Efficient Algorithms

Chapter 22 Developing Efficient Algorithms Chapter Developig Efficiet Algorithms 1 Executig Time Suppose two algorithms perform the same task such as search (liear search vs. biary search). Which oe is better? Oe possible approach to aswer this

More information

Math 210A Homework 1

Math 210A Homework 1 Math 0A Homework Edward Burkard Exercise. a) State the defiitio of a aalytic fuctio. b) What are the relatioships betwee aalytic fuctios ad the Cauchy-Riema equatios? Solutio. a) A fuctio f : G C is called

More information

MAT1026 Calculus II Basic Convergence Tests for Series

MAT1026 Calculus II Basic Convergence Tests for Series MAT026 Calculus II Basic Covergece Tests for Series Egi MERMUT 202.03.08 Dokuz Eylül Uiversity Faculty of Sciece Departmet of Mathematics İzmir/TURKEY Cotets Mootoe Covergece Theorem 2 2 Series of Real

More information

CIS 121 Data Structures and Algorithms with Java Spring Code Snippets and Recurrences Monday, February 4/Tuesday, February 5

CIS 121 Data Structures and Algorithms with Java Spring Code Snippets and Recurrences Monday, February 4/Tuesday, February 5 CIS 11 Data Structures ad Algorithms with Java Sprig 019 Code Sippets ad Recurreces Moday, February 4/Tuesday, February 5 Learig Goals Practice provig asymptotic bouds with code sippets Practice solvig

More information

Linearly Independent Sets, Bases. Review. Remarks. A set of vectors,,, in a vector space is said to be linearly independent if the vector equation

Linearly Independent Sets, Bases. Review. Remarks. A set of vectors,,, in a vector space is said to be linearly independent if the vector equation Liearly Idepedet Sets Bases p p c c p Review { v v vp} A set of vectors i a vector space is said to be liearly idepedet if the vector equatio cv + c v + + c has oly the trivial solutio = = { v v vp} The

More information

Mathematics review for CSCI 303 Spring Department of Computer Science College of William & Mary Robert Michael Lewis

Mathematics review for CSCI 303 Spring Department of Computer Science College of William & Mary Robert Michael Lewis Mathematics review for CSCI 303 Sprig 019 Departmet of Computer Sciece College of William & Mary Robert Michael Lewis Copyright 018 019 Robert Michael Lewis Versio geerated: 13 : 00 Jauary 17, 019 Cotets

More information

Algorithms and Data Structures Lecture IV

Algorithms and Data Structures Lecture IV Algorithms ad Data Structures Lecture IV Simoas Šalteis Aalborg Uiversity simas@cs.auc.dk September 5, 00 1 This Lecture Aalyzig the ruig time of recursive algorithms (such as divide-ad-coquer) Writig

More information

Properties and Tests of Zeros of Polynomial Functions

Properties and Tests of Zeros of Polynomial Functions Properties ad Tests of Zeros of Polyomial Fuctios The Remaider ad Factor Theorems: Sythetic divisio ca be used to fid the values of polyomials i a sometimes easier way tha substitutio. This is show by

More information

Stochastic Matrices in a Finite Field

Stochastic Matrices in a Finite Field Stochastic Matrices i a Fiite Field Abstract: I this project we will explore the properties of stochastic matrices i both the real ad the fiite fields. We first explore what properties 2 2 stochastic matrices

More information

COS 341 Discrete Mathematics. Exponential Generating Functions and Recurrence Relations

COS 341 Discrete Mathematics. Exponential Generating Functions and Recurrence Relations COS 341 Discrete Mathematics Epoetial Geeratig Fuctios ad Recurrece Relatios 1 Tetbook? 1 studets said they eeded the tetbook, but oly oe studet bought the tet from Triagle. If you do t have the book,

More information

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES

SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES SECTION 1.5 : SUMMATION NOTATION + WORK WITH SEQUENCES Read Sectio 1.5 (pages 5 9) Overview I Sectio 1.5 we lear to work with summatio otatio ad formulas. We will also itroduce a brief overview of sequeces,

More information

Sigma notation. 2.1 Introduction

Sigma notation. 2.1 Introduction Sigma otatio. Itroductio We use sigma otatio to idicate the summatio process whe we have several (or ifiitely may) terms to add up. You may have see sigma otatio i earlier courses. It is used to idicate

More information

A recurrence equation is just a recursive function definition. It defines a function at one input in terms of its value on smaller inputs.

A recurrence equation is just a recursive function definition. It defines a function at one input in terms of its value on smaller inputs. CS23 Algorithms Hadout #6 Prof Ly Turbak September 8, 200 Wellesley College RECURRENCES This hadout summarizes highlights of CLRS Chapter 4 ad Appedix A (CLR Chapters 3 & 4) Two-Step Strategy for Aalyzig

More information

Probability theory and mathematical statistics:

Probability theory and mathematical statistics: N.I. Lobachevsky State Uiversity of Nizhi Novgorod Probability theory ad mathematical statistics: Law of Total Probability. Associate Professor A.V. Zorie Law of Total Probability. 1 / 14 Theorem Let H

More information

( ) ( ), (S3) ( ). (S4)

( ) ( ), (S3) ( ). (S4) Ultrasesitivity i phosphorylatio-dephosphorylatio cycles with little substrate: Supportig Iformatio Bruo M.C. Martis, eter S. Swai 1. Derivatio of the equatios associated with the mai model From the differetial

More information

subcaptionfont+=small,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0 subcaption ALGEBRAIC COMBINATORICS LECTURE 8 TUESDAY, 2/16/2016

subcaptionfont+=small,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0 subcaption ALGEBRAIC COMBINATORICS LECTURE 8 TUESDAY, 2/16/2016 subcaptiofot+=small,labelformat=pares,labelsep=space,skip=6pt,list=0,hypcap=0 subcaptio ALGEBRAIC COMBINATORICS LECTURE 8 TUESDAY, /6/06. Self-cojugate Partitios Recall that, give a partitio λ, we may

More information

Mechatronics. Time Response & Frequency Response 2 nd -Order Dynamic System 2-Pole, Low-Pass, Active Filter

Mechatronics. Time Response & Frequency Response 2 nd -Order Dynamic System 2-Pole, Low-Pass, Active Filter Time Respose & Frequecy Respose d -Order Dyamic System -Pole, Low-Pass, Active Filter R 4 R 7 C 5 e i R 1 C R 3 - + R 6 - + e out Assigmet: Perform a Complete Dyamic System Ivestigatio of the Two-Pole,

More information

PRELIM PROBLEM SOLUTIONS

PRELIM PROBLEM SOLUTIONS PRELIM PROBLEM SOLUTIONS THE GRAD STUDENTS + KEN Cotets. Complex Aalysis Practice Problems 2. 2. Real Aalysis Practice Problems 2. 4 3. Algebra Practice Problems 2. 8. Complex Aalysis Practice Problems

More information

3.1 & 3.2 SEQUENCES. Definition 3.1: A sequence is a function whose domain is the positive integers (=Z ++ )

3.1 & 3.2 SEQUENCES. Definition 3.1: A sequence is a function whose domain is the positive integers (=Z ++ ) 3. & 3. SEQUENCES Defiitio 3.: A sequece is a fuctio whose domai is the positive itegers (=Z ++ ) Examples:. f() = for Z ++ or, 4, 6, 8, 0,. a = +/ or, ½, / 3, ¼, 3. b = /² or, ¼, / 9, 4. c = ( ) + or

More information

ROLL CUTTING PROBLEMS UNDER STOCHASTIC DEMAND

ROLL CUTTING PROBLEMS UNDER STOCHASTIC DEMAND Pacific-Asia Joural of Mathematics, Volume 5, No., Jauary-Jue 20 ROLL CUTTING PROBLEMS UNDER STOCHASTIC DEMAND SHAKEEL JAVAID, Z. H. BAKHSHI & M. M. KHALID ABSTRACT: I this paper, the roll cuttig problem

More information

You may work in pairs or purely individually for this assignment.

You may work in pairs or purely individually for this assignment. CS 04 Problem Solvig i Computer Sciece OOC Assigmet 6: Recurreces You may work i pairs or purely idividually for this assigmet. Prepare your aswers to the followig questios i a plai ASCII text file or

More information

DATA STRUCTURES I, II, III, AND IV

DATA STRUCTURES I, II, III, AND IV Data structures DATA STRUCTURES I, II, III, AND IV I. Amortized Aalysis II. Biary ad Biomial Heaps III. Fiboacci Heaps IV. Uio Fid Static problems. Give a iput, produce a output. Ex. Sortig, FFT, edit

More information