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

Size: px
Start display at page:

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

Transcription

1 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 Jordi Cortadella ad Jordi Petit Departmet of Computer Sciece The work is doe i three places: I partitioig the problem ito subproblems I solvig the basic cases at the tail of the recursio I mergig the aswers of the subproblems to obtai the solutio of the origial problem Covetioal product of polyomials Divide & Coquer Dept. CS, UPC Covetioal product of polyomials Example: fuctio PolyomialProduct(P, Q) // P ad Q are vectors of coefficiets. // Returs R = P Q. // degree(p) = size(p)-1, degree(q) = size(q)-1. // degree(r) = degree(p)+degree(q). R = vector with size(p)+size(q)-1 zeros; for each P i for each Q j R i+j = R i+j + P i Q j retur R Complexity aalysis: Multiplicatio of polyomials of degree : O Additio of polyomials of degree : O() Divide & Coquer Dept. CS, UPC 3 Divide & Coquer Dept. CS, UPC 4

2 Product of polyomials: Divide&Coquer Assume that we have two polyomials with coefficiets (degree 1) P: Q: 1 P L Q L / P R Q R 0 Product of complex umbers The product of two complex umbers requires four multiplicatios: a + bi c + di = ac bd + bc + ad i Carl Friedrich Gauss ( ) oticed that it ca be doe with just three: ac, bd ad a + b c + d bc + ad = a + b c + d ac bd Show later Divide & Coquer Dept. CS, UPC 5 Product of polyomials with Gauss s trick A similar observatio applies for polyomial multiplicatio. Divide & Coquer Dept. CS, UPC 6 Polyomial multiplicatio: recursive step P Q P L Q L P L Q R + P R Q L P L + P R Q L + Q R P R Q R Divide & Coquer Dept. CS, UPC 7 Divide & Coquer Dept. CS, UPC 8

3 Patter of recursive calls Complexity aalysis Type equatio here. / / / /4 /4 /4 /4 /4 /4 /4 /4 / Brachig factor: log levels The time spet at level k is 3 k O k = 3 For k = 0, rutime is O. k O() For k = log, rutime is O 3 log, which is equal to O log 3. The rutime per level icreases geometrically by a factor of 3/ per level. The sum of ay icreasig geometric series is, withi a costat factor, simply the last term of the series. Therefore, the complexity is O Divide & Coquer Dept. CS, UPC 9 A popular recursio tree Divide & Coquer Dept. CS, UPC 10 Examples Brachig factor: / / log levels 1 1 / /4 /4 / Algorithm Brach c Rutime equatio Power (x y ) 1 0 T y = T yτ + O(1) Biary search 1 0 T = T Τ + O(1) Merge sort 1 T = T Τ + O() Polyomial product 4 1 T = 4 T Τ + O() Polyomial product (Gauss) 3 1 T = 3 T Τ + O() Example: efficiet sortig algorithms. T = T + O Algorithms may differ o the amout of work doe at each level: O c Divide & Coquer Dept. CS, UPC 11 Divide & Coquer Dept. CS, UPC 1

4 Master theorem Typical patter for Divide&Coquer algorithms: Split the problem ito a subproblems of size /b Solve each subproblem recursively Combie the aswers i O( c ) time Size Size /b Ruig time: T = a T Τ b + O( c ) Master theorem: Size /b O c if c > log b a (a < b c ) T = O c log if c = log b a (a = b c ) O log b a if c < log b a (a > b c ) Master theorem: recursio tree Brachig factor a. Depth log b Size 1 Width a log b = log b a Divide & Coquer Dept. CS, UPC 13 Master theorem: proof For simplicity, assume is a power of b. The base case is reached after log b levels. The kth level of the tree has a k subproblems of size Τb k. The total work doe at level k is: a k O b k c = O c a b c k As k goes from 0 (the root) to log b (the leaves), these umbers form a geometric series with ratio aτb c. We eed to fid the sum of such a series. T = O c 1 + a b b a a3 + + c c b 3c + + alogb b (log b )c Divide & Coquer Dept. CS, UPC 14 Master theorem: proof Case aτb c < 1. Decreasig series. The sum is domiated by the first term (k = 0): O( c ). Case aτb c < 1. Icreasig series. The sum is domiated by the last term (k = log b ): c a b c log b = c a log b = a (log a )(log b a) = log b a b log b c = a log b = Case aτb c = 1. We have O log terms all equal to O( c ). Divide & Coquer Dept. CS, UPC 15 Divide & Coquer Dept. CS, UPC 16

5 Master theorem: examples Ruig time: T = a T Τb + O c O c T = O c log O log b a if a < b c if a = b c if a > b c Algorithm a c Rutime equatio Complexity Power (x y ) 1 0 T y = T yτ + O(1) Biary search 1 0 T = T Τ + O(1) Merge sort 1 T = T Τ + O() O(log y) O(log ) O( log ) Polyomial product 4 1 T = 4 T Τ + O() O( ) Polyomial product (Gauss) 3 1 T = 3 T Τ + O() O( log 3 ) b = for all the examples Divide & Coquer Dept. CS, UPC 17 Quick sort with Hugaria, folk dace Quick sort (Toy Hoare, 1959) Suppose that we kow a umber x such that oe-half of the elemets of a vector are greater tha or equal to x ad oe-half of the elemets are smaller tha x. Partitio the vector ito two equal parts ( 1 comparisos) Sort each part recursively Problem: we do ot kow x. The algorithm also works o matter which x we pick for the partitio. We call this umber the pivot. Observatio: the partitio may be ubalaced. Divide & Coquer Dept. CS, UPC 18 pivot Quick sort: example Partitio Qsort Qsort The key step of quick sort is the partitioig algorithm. Questio: how to fid a good pivot? Divide & Coquer Dept. CS, UPC 19 Divide & Coquer Dept. CS, UPC 0

6 Quick sort Quick sort: partitio fuctio Partitio(A, left, right) // A[left..right]: segmet to be sorted // Returs the middle of the partitio with // A[middle] = pivot // A[left..middle-1] pivot // A[middle+1..right] > pivot x = A[left]; // the pivot i = left; j = right; while i < j do while A[i] x ad i right do i = i+1; while A[j] > x ad j left do j = j-1; if i < j the swap(a[i], A[j]); swap(a[left], A[j]); retur j; Divide & Coquer Dept. CS, UPC 1 Quick sort partitio: example Divide & Coquer Dept. CS, UPC Quick sort: algorithm pivot fuctio Qsort(A, left, right) // A[left..right]: segmet to be sorted if left < right the mid = Partitio(A, left, right); Qsort(A, left, mid-1); Qsort(A, mid+1, right); middle Divide & Coquer Dept. CS, UPC 3 Divide & Coquer Dept. CS, UPC 4

7 Quick sort: Hoare s partitio Quick sort partitio: example fuctio HoarePartitio(A, left, right) // A[left..right]: segmet to be sorted. // Output: The left part has elemets tha the pivot. // The right part has elemets tha the pivot. // Returs the idex of the last elemet of the left part. x = A[left]; // the pivot i = left-1; j = right+1; while true do do i = i+1; while A[i] < x; do j = j-1; while A[j] > x; if i j the retur j; pivot First swap: 4 is a setiel for R; 6 is a setiel for L o eed to check for boudaries i j swap(a[i], A[j]); Admire a uique piece of art by Hoare: The first swap creates two setiels. After that, the algorithm flies j (middle) Divide & Coquer Dept. CS, UPC 5 Quick sort with Hoare s partitio Divide & Coquer Dept. CS, UPC 6 Quick sort: hybrid approach fuctio Qsort(A, left, right) // A[left..right]: segmet to be sorted if left < right the mid = HoarePartitio(A, left, right); Qsort(A, left, mid); Qsort(A, mid+1, right); fuctio Qsort(A, left, right) // A[left..right]: segmet to be sorted. // K is a break-eve size i which isertio sort is // more efficiet tha quick sort. if right left K the mid = HoarePartitio(A, left, right); Qsort(A, left, mid); Qsort(A, mid+1, right); fuctio Sort(A): Qsort(A, 0, A.size()-1); IsertioSort(A); Divide & Coquer Dept. CS, UPC 7 Divide & Coquer Dept. CS, UPC 8

8 Quick sort: complexity aalysis The partitio algorithm is O(). Assume that the partitio is balaced: T = T( Τ) + O = O( log ) Worst case rutime: the pivot is always the smallest elemet i the vector O( ) Selectig a good pivot is essetial. There are differet strategies, e.g., Take the media of the first, last ad middle elemets Take the pivot at radom Quick sort: complexity aalysis Let us assume that x i is the ith smallest elemet i the vector. Let us assume that each elemet has the same probability of beig selected as pivot. The rutime if x i is selected as pivot is: T = 1 + T i 1 + T( i) Divide & Coquer Dept. CS, UPC 9 Quick sort: complexity aalysis T = T i 1 + T( i) i=1 T = T i T( i) i=1 i=1 1 T = 1 + T i ( + 1)(H ) i=0 H = 1 + 1Τ + 1Τ Τ is the Harmoic series, that has a simple approximatio: H = l + γ + O 1Τ. γ = is Euler s costat. T + 1 l + γ O 1 = O( log ) Divide & Coquer Dept. CS, UPC 30 Quick sort: complexity aalysis summary Rutime of quicksort: T = O T = Ω( log ) T avg = O( log ) Be careful: some malicious patters may icrease the probability of the worst case rutime, e.g., whe the vector is sorted or almost sorted. Possible solutio: use radom pivots. Divide & Coquer Dept. CS, UPC 31 Divide & Coquer Dept. CS, UPC 3

9 The selectio problem Give a collectio of N elemets, fid the kth smallest elemet. Optios: Sort a vector ad select the kth locatio: O(N log N) Read k elemets ito a vector ad sort them. The remaiig elemets are processed oe by oe ad placed i the correct locatio (similar to isertio sort). Oly k elemets are maitaied i the vector. Complexity: O kn. Why? The selectio problem usig a heap Algorithm: Build a heap from the collectio of elemets: O(N) Remove k elemets: O(k log N) Note: heaps will be see later i the course Complexity: I geeral: O N + k log N For small values of k, i.e., k = O( NΤlog N), the complexity is O(N). For large values of k, the complexity is O(k log N). Divide & Coquer Dept. CS, UPC 33 Quick sort with Hoare s partitio Divide & Coquer Dept. CS, UPC 34 Quick select with Hoare s partitio fuctio Qsort(A, left, right) // A[left..right]: segmet to be sorted if left < right the mid = HoarePartitio(A, left, right); Qsort(A, left, mid); Qsort(A, mid+1, right); // Returs the elemet at locatio k assumig // A[left..right] would be sorted i ascedig order. // Pre: left k right. // Post: The elemets of A have chaged their locatios. fuctio Qselect(A, left, right, k) if left == right the retur A[left]; mid = HoarePartitio(A, left, right); // We oly eed to sort oe half of A if k mid the Qselect(A, left, mid, k); else Qselect(A, mid+1, right, k); Divide & Coquer Dept. CS, UPC 35 Divide & Coquer Dept. CS, UPC 36

10 Quick Select: complexity The Closest-Poits problem Assume that the partitio is balaced: Quick sort: T = T( Τ) + O = O( log ) Quick select: T = T( Τ) + O = O() Iput: A list of poits i the plae x 1, y 1, x, y,, x, y Output: The pair of closest poits Simple approach: check all pairs O( ) We wat a O( log ) solutio! The average liear time complexity ca be achieved by choosig good pivots (similar strategy ad complexity computatio to qsort). Divide & Coquer Dept. CS, UPC 37 The Closest-Poits problem We ca assume that the poits are sorted by the x-coordiate. Sortig the poits is free from the complexity stadpoit (O( log )). Split the list ito two halves. The closest poits ca be both at the left, both at the right or oe at the left ad the other at the right (ceter). The left ad right pairs are easy to fid (recursively). How about the pairs i the ceter? Divide & Coquer Dept. CS, UPC 38 The Closest-Poits problem Let δ = mi δ L, δ R. We oly eed to compute δ C if it improves δ. We ca defie a strip aroud de ceter with distace δ at the left ad right. If δ C improves δ, the the poits must be withi the strip. I the worst case, all poits ca still reside i the strip. But how may poits do we really have to cosider? δ L δ C δ L δ R δ R δ δ Divide & Coquer Dept. CS, UPC 39 Divide & Coquer Dept. CS, UPC 40

11 The Closest-Poits problem The Closest-Poits problem Let us take all poits i the strip ad sort them by the y-coordiate. We oly eed to cosider pairs of poits with distace smaller tha δ. Oce we fid a pair (p i, p j ) with y-coordiates that differ by more tha δ, we ca move to the ext p i. for (i=0; i < NumPoitsIStrip; ++i) for (j=i+1; j < NumPoitsIStrip; ++j) if (p i ad p j s y-coordiate differ by more tha δ) break; // Go to ext p i if (dist p i, p j < δ) δ = dist p i, p j ; For every poit p i at oe side of the strip, we oly eed to cosider poits from p i+1. The relevat poits oly reside i the δ δ rectagle below poit p i. There ca oly be 8 poits at most i this rectagle (4 at the left ad 4 at the right). Some poits may have the same coordiates. δ δ δ But, how may pairs p i, p j do we eed to cosider? Divide & Coquer Dept. CS, UPC 41 The Closest-Poits problem: algorithm Sort the poits accordig to their x-coordiates. Divide the set ito two equal-sized parts. Compute the mi distace at each part (recursively). Let δ be the miimal of the two miimal distaces. Elimiate poits that are farther tha δ from the separatio lie. Sort the remaiig poits accordig to their y-coordiates. Sca the remaiig poits i the y order ad compute the distaces of each poit to its 7 eighbors. Divide & Coquer Dept. CS, UPC 4 The Closest-Poits problem: complexity Iitial sort usig x-coordiates: O( log ). It comes for free. Divide ad coquer: Solve for each part recursively: T Τ Elimiate poits farther tha δ: O Sort remaiig poits usig y-coordiates: O log Sca the remaiig poits i y order: O T = T Τ + O + O log = O( log ) Ca we do it i O( log )? Yes, we eed to sort by y i a smart way. Divide & Coquer Dept. CS, UPC 43 Divide & Coquer Dept. CS, UPC 44

12 The Closest-Poits problem: complexity Let Y a vector with the poits sorted by the y-coordiates. This ca be doe iitially for free. Each time we partitio the set of poits by the x-coordiate, we also partitio Y ito two sorted vectors (usig a umergig procedure with liear complexity) Y L = Y R = // Iitial lists of poits foreach p i Y i ascedig order of y do if p i is at the left part the Y L.push_back(p i ) else Y R.push_back(p i ) APPENDIX Now, sortig the poits by the y-coordiate at each iteratio ca be doe i liear time, ad the problem ca be solved i O( log ) Divide & Coquer Dept. CS, UPC 45 T = 1 + i=0 Full-history recurrece relatio 1 T i 1 T = 1 + T i, i=0 + 1 T + 1 = T(i) + 1 T + 1 T = T = + T() T + 1 = + T T T A recurrece that depeds o all the previous values of the fuctio. T i=0 Divide & Coquer Dept. CS, UPC 46 Harmoic series H = k = k=1 k න 1 k= +1 dx l( + 1) 1 x k k=1 T = ( + 1) H = Θ(log ) T + 1 H = Θ( log ) Divide & Coquer Dept. CS, UPC 47 Divide & Coquer Dept. CS, UPC 48

Divide & Conquer. Jordi Cortadella and Jordi Petit Department of Computer Science

Divide & Conquer. Jordi Cortadella and Jordi Petit Department of Computer Science Divide & Conquer Jordi Cortadella and Jordi Petit Department of Computer Science Divide-and-conquer algorithms Strategy: Divide the problem into smaller subproblems of the same type of problem Solve the

More information

Divide & Conquer. Jordi Cortadella and Jordi Petit Department of Computer Science

Divide & Conquer. Jordi Cortadella and Jordi Petit Department of Computer Science Divide & Conquer Jordi Cortadella and Jordi Petit Department of Computer Science Divide-and-conquer algorithms Strategy: Divide the problem into smaller subproblems of the same type of problem Solve the

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

CS 332: Algorithms. Linear-Time Sorting. Order statistics. Slide credit: David Luebke (Virginia)

CS 332: Algorithms. Linear-Time Sorting. Order statistics. Slide credit: David Luebke (Virginia) 1 CS 332: Algorithms Liear-Time Sortig. Order statistics. Slide credit: David Luebke (Virgiia) Quicksort: Partitio I Words Partitio(A, p, r): Select a elemet to act as the pivot (which?) Grow two regios,

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Desig ad Aalysis of Algorithms CSE 53 Lecture 9 Media ad Order Statistics Juzhou Huag, Ph.D. Departmet of Computer Sciece ad Egieerig Dept. CSE, UT Arligto CSE53 Desig ad Aalysis of Algorithms Medias ad

More information

Analysis of Algorithms -Quicksort-

Analysis of Algorithms -Quicksort- Aalysis of Algorithms -- Adreas Ermedahl MRTC (Mälardales Real-Time Research Ceter) adreas.ermedahl@mdh.se Autum 2004 Proposed by C.A.R. Hoare i 962 Worst- case ruig time: Θ( 2 ) Expected ruig time: Θ(

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

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

COMP285 Midterm Exam Department of Mathematics

COMP285 Midterm Exam Department of Mathematics COMP85 Midterm Exam Departmet of Mathematics Fall 010/011 - November 8, 010 Name: Studet Number: Please fiish withi 90 miutes. All poits above 100 are cosidered as bous poit. You ca reach maximal 1 poits.

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

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

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

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

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

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

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

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

) 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

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

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

CS 5150/6150: Assignment 1 Due: Sep 23, 2010

CS 5150/6150: Assignment 1 Due: Sep 23, 2010 CS 5150/6150: Assigmet 1 Due: Sep 23, 2010 Wei Liu September 24, 2010 Q1: (1) Usig master theorem: a = 7, b = 4, f() = O(). Because f() = log b a ε holds whe ε = log b a = log 4 7, we ca apply the first

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

Analysis of Algorithms. Introduction. Contents

Analysis of Algorithms. Introduction. Contents Itroductio The focus of this module is mathematical aspects of algorithms. Our mai focus is aalysis of algorithms, which meas evaluatig efficiecy of algorithms by aalytical ad mathematical methods. We

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

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

A Probabilistic Analysis of Quicksort

A Probabilistic Analysis of Quicksort A Probabilistic Aalysis of Quicsort You are assumed to be familiar with Quicsort. I each iteratio this sortig algorithm chooses a pivot ad the, by performig comparisios with the pivot, splits the remaider

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

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

Divide and Conquer II

Divide and Conquer II Algorithms Divide ad Coquer II Divide ad Coquer II Desig ad Aalsis of Algorithms Adrei Bulatov Algorithms Divide ad Coquer II 6- Closest Pair: The Problem The Closest Pair Problem Istace: poits i the plae

More information

Divide and Conquer. 1 Overview. 2 Multiplying Bit Strings. COMPSCI 330: Design and Analysis of Algorithms 1/19/2016 and 1/21/2016

Divide and Conquer. 1 Overview. 2 Multiplying Bit Strings. COMPSCI 330: Design and Analysis of Algorithms 1/19/2016 and 1/21/2016 COMPSCI 330: Desig ad Aalysis of Algorithms 1/19/2016 ad 1/21/2016 Lecturer: Debmalya Paigrahi Divide ad Coquer Scribe: Tiaqi Sog 1 Overview I this lecture, a importat algorithm desig techique called divide-ad-coquer

More information

Divide and Conquer. 1 Overview. 2 Insertion Sort. COMPSCI 330: Design and Analysis of Algorithms 1/19/2016 and 1/21/2016

Divide and Conquer. 1 Overview. 2 Insertion Sort. COMPSCI 330: Design and Analysis of Algorithms 1/19/2016 and 1/21/2016 COMPSCI 330: Desig ad Aalysis of Algorithms 1/19/2016 ad 1/21/2016 Divide ad Coquer Lecturer: Debmalya Paigrahi Scribe: Tiaqi Sog, Tiayu Wag 1 Overview This set of otes is orgaized as follows. We begi

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

CS:3330 (Prof. Pemmaraju ): Assignment #1 Solutions. (b) For n = 3, we will have 3 men and 3 women with preferences as follows: m 1 : w 3 > w 1 > w 2

CS:3330 (Prof. Pemmaraju ): Assignment #1 Solutions. (b) For n = 3, we will have 3 men and 3 women with preferences as follows: m 1 : w 3 > w 1 > w 2 Shiyao Wag CS:3330 (Prof. Pemmaraju ): Assigmet #1 Solutios Problem 1 (a) Cosider iput with me m 1, m,..., m ad wome w 1, w,..., w with the followig prefereces: All me have the same prefereces for wome:

More information

CS 332: Algorithms. Quicksort

CS 332: Algorithms. Quicksort CS 33: Aorithms Quicsort David Luebe //03 Homewor Assiged today, due ext Wedesday Will be o web page shortly after class Go over ow David Luebe //03 Review: Quicsort Sorts i place Sorts O( ) i the average

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures ad Algorithms Autum 2017-2018 Outlie 1 Sortig Algorithms (cotd) Outlie Sortig Algorithms (cotd) 1 Sortig Algorithms (cotd) Heapsort Sortig Algorithms (cotd) Have see that we ca build a

More information

Polynomial Multiplication and Fast Fourier Transform

Polynomial Multiplication and Fast Fourier Transform Polyomial Multiplicatio ad Fast Fourier Trasform Com S 477/577 Notes Ya-Bi Jia Sep 19, 2017 I this lecture we will describe the famous algorithm of fast Fourier trasform FFT, which has revolutioized digital

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

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

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

Advanced Course of Algorithm Design and Analysis

Advanced Course of Algorithm Design and Analysis Differet complexity measures Advaced Course of Algorithm Desig ad Aalysis Asymptotic complexity Big-Oh otatio Properties of O otatio Aalysis of simple algorithms A algorithm may may have differet executio

More information

Examples: data compression, path-finding, game-playing, scheduling, bin packing

Examples: data compression, path-finding, game-playing, scheduling, bin packing Algorithms - Basic Cocepts Algorithms so what is a algorithm, ayway? The dictioary defiitio: A algorithm is a well-defied computatioal procedure that takes iput ad produces output. This class will deal

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

Chapter 9: Numerical Differentiation

Chapter 9: Numerical Differentiation 178 Chapter 9: Numerical Differetiatio Numerical Differetiatio Formulatio of equatios for physical problems ofte ivolve derivatives (rate-of-chage quatities, such as velocity ad acceleratio). Numerical

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

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

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

Algorithms Design & Analysis. Divide & Conquer

Algorithms Design & Analysis. Divide & Conquer Algorithms Desig & Aalysis Divide & Coquer Recap Direct-accessible table Hash tables Hash fuctios Uiversal hashig Perfect Hashig Ope addressig 2 Today s topics The divide-ad-coquer desig paradigm Revised

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

Algorithm Analysis. Algorithms that are equally correct can vary in their utilization of computational resources

Algorithm Analysis. Algorithms that are equally correct can vary in their utilization of computational resources Algorithm Aalysis Algorithms that are equally correct ca vary i their utilizatio of computatioal resources time ad memory a slow program it is likely ot to be used a program that demads too much memory

More information

2. ALGORITHM ANALYSIS

2. ALGORITHM ANALYSIS 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times 2. ALGORITHM ANALYSIS computatioal tractability survey of commo ruig times Lecture slides by Kevi Waye Copyright 2005 Pearso-Addiso

More information

3.2 Properties of Division 3.3 Zeros of Polynomials 3.4 Complex and Rational Zeros of Polynomials

3.2 Properties of Division 3.3 Zeros of Polynomials 3.4 Complex and Rational Zeros of Polynomials Math 60 www.timetodare.com 3. Properties of Divisio 3.3 Zeros of Polyomials 3.4 Complex ad Ratioal Zeros of Polyomials I these sectios we will study polyomials algebraically. Most of our work will be cocered

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

Zeros of Polynomials

Zeros of Polynomials Math 160 www.timetodare.com 4.5 4.6 Zeros of Polyomials I these sectios we will study polyomials algebraically. Most of our work will be cocered with fidig the solutios of polyomial equatios of ay degree

More information

COMP26120: More on the Complexity of Recursive Programs (2018/19) Lucas Cordeiro

COMP26120: More on the Complexity of Recursive Programs (2018/19) Lucas Cordeiro COMP26120: More o the Complexity of Recursive Programs (2018/19) Lucas Cordeiro lucas.cordeiro@machester.ac.uk Divide-ad-Coquer (Recurrece) Textbook: Algorithm Desig ad Applicatios, Goodrich, Michael T.

More information

Data Structures and Algorithm. Xiaoqing Zheng

Data Structures and Algorithm. Xiaoqing Zheng Data Structures ad Algorithm Xiaoqig Zheg zhegxq@fudaeduc What are algorithms? A sequece of computatioal steps that trasform the iput ito the output Sortig problem: Iput: A sequece of umbers

More information

CS161: Algorithm Design and Analysis Handout #10 Stanford University Wednesday, 10 February 2016

CS161: Algorithm Design and Analysis Handout #10 Stanford University Wednesday, 10 February 2016 CS161: Algorithm Desig ad Aalysis Hadout #10 Staford Uiversity Wedesday, 10 February 2016 Lecture #11: Wedesday, 10 February 2016 Topics: Example midterm problems ad solutios from a log time ago Sprig

More information

Chapter 2. Asymptotic Notation

Chapter 2. Asymptotic Notation Asyptotic Notatio 3 Chapter Asyptotic Notatio Goal : To siplify the aalysis of ruig tie by gettig rid of details which ay be affected by specific ipleetatio ad hardware. [1] The Big Oh (O-Notatio) : It

More information

The picture in figure 1.1 helps us to see that the area represents the distance traveled. Figure 1: Area represents distance travelled

The picture in figure 1.1 helps us to see that the area represents the distance traveled. Figure 1: Area represents distance travelled 1 Lecture : Area Area ad distace traveled Approximatig area by rectagles Summatio The area uder a parabola 1.1 Area ad distace Suppose we have the followig iformatio about the velocity of a particle, how

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

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

Lecture 7: Solving Recurrences

Lecture 7: Solving Recurrences Lecture 7: Solvig Recurreces CSE 7: Data Structures ad Algorithms CSE 7 19 WI KASEY CHAMPION 1 Warm Up Writig Recurreces CSE 7 19 WI KASEY CHAMPION 2 Admiistriva HW 2 Part 1 due Friday git ruers will get

More information

Definitions and Theorems. where x are the decision variables. c, b, and a are constant coefficients.

Definitions and Theorems. where x are the decision variables. c, b, and a are constant coefficients. Defiitios ad Theorems Remember the scalar form of the liear programmig problem, Miimize, Subject to, f(x) = c i x i a 1i x i = b 1 a mi x i = b m x i 0 i = 1,2,, where x are the decisio variables. c, b,

More information

Introduction to Algorithms 6.046J/18.401J LECTURE 3 Divide and conquer Binary search Powering a number Fibonacci numbers Matrix multiplication

Introduction to Algorithms 6.046J/18.401J LECTURE 3 Divide and conquer Binary search Powering a number Fibonacci numbers Matrix multiplication Itroductio to Algorithms 6.046J/8.40J LECTURE 3 Divide ad coquer Biary search Powerig a umber Fiboacci umbers Matrix multiplicatio Strasse s algorithm VLSI tree layout Prof. Charles E. Leiserso The divide-ad-coquer

More information

Design and Analysis of ALGORITHM (Topic 2)

Design and Analysis of ALGORITHM (Topic 2) DR. Gatot F. Hertoo, MSc. Desig ad Aalysis of ALGORITHM (Topic 2) Algorithms + Data Structures = Programs Lessos Leared 1 Our Machie Model: Assumptios Geeric Radom Access Machie (RAM) Executes operatios

More information

4.1 SIGMA NOTATION AND RIEMANN SUMS

4.1 SIGMA NOTATION AND RIEMANN SUMS .1 Sigma Notatio ad Riema Sums Cotemporary Calculus 1.1 SIGMA NOTATION AND RIEMANN SUMS Oe strategy for calculatig the area of a regio is to cut the regio ito simple shapes, calculate the area of each

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

An Introduction to Randomized Algorithms

An Introduction to Randomized Algorithms A Itroductio to Radomized Algorithms The focus of this lecture is to study a radomized algorithm for quick sort, aalyze it usig probabilistic recurrece relatios, ad also provide more geeral tools for aalysis

More information

CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN

CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN CSI 5163 (95.573) ALGORITHM ANALYSIS AND DESIGN CSI 5163 (95.5703) ALGORITHM ANALYSIS AND DESIGN (3 cr.) (T) Topics of curret iterest i the desig ad aalysis of computer algorithms for graphtheoretical

More information

(c) Write, but do not evaluate, an integral expression for the volume of the solid generated when R is

(c) Write, but do not evaluate, an integral expression for the volume of the solid generated when R is Calculus BC Fial Review Name: Revised 7 EXAM Date: Tuesday, May 9 Remiders:. Put ew batteries i your calculator. Make sure your calculator is i RADIAN mode.. Get a good ight s sleep. Eat breakfast. Brig:

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

4.1 Sigma Notation and Riemann Sums

4.1 Sigma Notation and Riemann Sums 0 the itegral. Sigma Notatio ad Riema Sums Oe strategy for calculatig the area of a regio is to cut the regio ito simple shapes, calculate the area of each simple shape, ad the add these smaller areas

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

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

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

Math 113 Exam 3 Practice

Math 113 Exam 3 Practice Math Exam Practice Exam will cover.-.9. This sheet has three sectios. The first sectio will remid you about techiques ad formulas that you should kow. The secod gives a umber of practice questios for you

More information

Problem Cosider the curve give parametrically as x = si t ad y = + cos t for» t» ß: (a) Describe the path this traverses: Where does it start (whe t =

Problem Cosider the curve give parametrically as x = si t ad y = + cos t for» t» ß: (a) Describe the path this traverses: Where does it start (whe t = Mathematics Summer Wilso Fial Exam August 8, ANSWERS Problem 1 (a) Fid the solutio to y +x y = e x x that satisfies y() = 5 : This is already i the form we used for a first order liear differetial equatio,

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

CSED233: Data Structures (2018F) Lecture13: Sorting and Selection

CSED233: Data Structures (2018F) Lecture13: Sorting and Selection (018F) Lecture13: Sortig ad Selectio Daiji Kim CSE, POSECH dkim@postech.ac.kr Divide-ad-Coquer Divide-ad coquer a geeral algorithm desig paradigm: Divide: divide the iput data S i two djoit susets S 1

More information

Discrete Mathematics Recurrences

Discrete Mathematics Recurrences Discrete Mathematics Recurreces Saad Meimeh 1 What is a recurrece? It ofte happes that, i studyig a sequece of umbers a, a coectio betwee a ad a 1, or betwee a ad several of the previous a i, i

More information

SOLUTIONS TO EXAM 3. Solution: Note that this defines two convergent geometric series with respective radii r 1 = 2/5 < 1 and r 2 = 1/5 < 1.

SOLUTIONS TO EXAM 3. Solution: Note that this defines two convergent geometric series with respective radii r 1 = 2/5 < 1 and r 2 = 1/5 < 1. SOLUTIONS TO EXAM 3 Problem Fid the sum of the followig series 2 + ( ) 5 5 2 5 3 25 2 2 This series diverges Solutio: Note that this defies two coverget geometric series with respective radii r 2/5 < ad

More information

NUMERICAL METHODS FOR SOLVING EQUATIONS

NUMERICAL METHODS FOR SOLVING EQUATIONS Mathematics Revisio Guides Numerical Methods for Solvig Equatios Page 1 of 11 M.K. HOME TUITION Mathematics Revisio Guides Level: GCSE Higher Tier NUMERICAL METHODS FOR SOLVING EQUATIONS Versio:. Date:

More information

PAPER : IIT-JAM 2010

PAPER : IIT-JAM 2010 MATHEMATICS-MA (CODE A) Q.-Q.5: Oly oe optio is correct for each questio. Each questio carries (+6) marks for correct aswer ad ( ) marks for icorrect aswer.. Which of the followig coditios does NOT esure

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

Ma 530 Infinite Series I

Ma 530 Infinite Series I Ma 50 Ifiite Series I Please ote that i additio to the material below this lecture icorporated material from the Visual Calculus web site. The material o sequeces is at Visual Sequeces. (To use this li

More information

THE SOLUTION OF NONLINEAR EQUATIONS f( x ) = 0.

THE SOLUTION OF NONLINEAR EQUATIONS f( x ) = 0. THE SOLUTION OF NONLINEAR EQUATIONS f( ) = 0. Noliear Equatio Solvers Bracketig. Graphical. Aalytical Ope Methods Bisectio False Positio (Regula-Falsi) Fied poit iteratio Newto Raphso Secat The root of

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

18.01 Calculus Jason Starr Fall 2005

18.01 Calculus Jason Starr Fall 2005 Lecture 18. October 5, 005 Homework. Problem Set 5 Part I: (c). Practice Problems. Course Reader: 3G 1, 3G, 3G 4, 3G 5. 1. Approximatig Riema itegrals. Ofte, there is o simpler expressio for the atiderivative

More information

CSE Introduction to Parallel Processing. Chapter 3. Parallel Algorithm Complexity

CSE Introduction to Parallel Processing. Chapter 3. Parallel Algorithm Complexity Dr. Izadi CSE-40533 Itroductio to Parallel Processig Chapter 3 Parallel Algorithm Complexity Review algorithm complexity ad various complexity classes Itroduce the otios of time ad time-cost optimality

More information

10-701/ Machine Learning Mid-term Exam Solution

10-701/ Machine Learning Mid-term Exam Solution 0-70/5-78 Machie Learig Mid-term Exam Solutio Your Name: Your Adrew ID: True or False (Give oe setece explaatio) (20%). (F) For a cotiuous radom variable x ad its probability distributio fuctio p(x), it

More information

Lecture 3: Divide and Conquer: Fast Fourier Transform

Lecture 3: Divide and Conquer: Fast Fourier Transform Lecture 3: Divide ad Coquer: Fast Fourier Trasform Polyomial Operatios vs. Represetatios Divide ad Coquer Algorithm Collapsig Samples / Roots of Uity FFT, IFFT, ad Polyomial Multiplicatio Polyomial operatios

More information

f(x) dx as we do. 2x dx x also diverges. Solution: We compute 2x dx lim

f(x) dx as we do. 2x dx x also diverges. Solution: We compute 2x dx lim Math 3, Sectio 2. (25 poits) Why we defie f(x) dx as we do. (a) Show that the improper itegral diverges. Hece the improper itegral x 2 + x 2 + b also diverges. Solutio: We compute x 2 + = lim b x 2 + =

More information

Section 11.8: Power Series

Section 11.8: Power Series Sectio 11.8: Power Series 1. Power Series I this sectio, we cosider geeralizig the cocept of a series. Recall that a series is a ifiite sum of umbers a. We ca talk about whether or ot it coverges ad i

More information

Lecture 7: Density Estimation: k-nearest Neighbor and Basis Approach

Lecture 7: Density Estimation: k-nearest Neighbor and Basis Approach STAT 425: Itroductio to Noparametric Statistics Witer 28 Lecture 7: Desity Estimatio: k-nearest Neighbor ad Basis Approach Istructor: Ye-Chi Che Referece: Sectio 8.4 of All of Noparametric Statistics.

More information

Section A assesses the Units Numerical Analysis 1 and 2 Section B assesses the Unit Mathematics for Applied Mathematics

Section A assesses the Units Numerical Analysis 1 and 2 Section B assesses the Unit Mathematics for Applied Mathematics X0/70 NATIONAL QUALIFICATIONS 005 MONDAY, MAY.00 PM 4.00 PM APPLIED MATHEMATICS ADVANCED HIGHER Numerical Aalysis Read carefully. Calculators may be used i this paper.. Cadidates should aswer all questios.

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

6 Integers Modulo n. integer k can be written as k = qn + r, with q,r, 0 r b. So any integer.

6 Integers Modulo n. integer k can be written as k = qn + r, with q,r, 0 r b. So any integer. 6 Itegers Modulo I Example 2.3(e), we have defied the cogruece of two itegers a,b with respect to a modulus. Let us recall that a b (mod ) meas a b. We have proved that cogruece is a equivalece relatio

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

Design and Analysis of Algorithms

Design and Analysis of Algorithms Desig ad Aalysis of Algorithms Probabilistic aalysis ad Radomized algorithms Referece: CLRS Chapter 5 Topics: Hirig problem Idicatio radom variables Radomized algorithms Huo Hogwei 1 The hirig problem

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

CS537. Numerical Analysis and Computing

CS537. Numerical Analysis and Computing CS57 Numerical Aalysis ad Computig Lecture Locatig Roots o Equatios Proessor Ju Zhag Departmet o Computer Sciece Uiversity o Ketucky Leigto KY 456-6 Jauary 9 9 What is the Root May physical system ca be

More information