CS / MCS 401 Homework 3 grader solutions
|
|
- Juliana Brooks
- 6 years ago
- Views:
Transcription
1 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 a biomial radom variable X ad the defiitio of the expected value E[X] = all x x P (x) to prove E[X] = p. Do ot use idicator radom variables. Let X be a biomial radom variable with probability p of success, ad suppose that X is evaluated times. Recall the probability of k successes over trials for X is ( k) p k (1 p) k. The expected value of X is the E[X] = all x x P (x) (defiitio) = k P (k successes) (sice trials, reamig x to k) k=0 ( ) = k p k (1 p) k k k=0 (defiitio)! = k k!( k)! pk (1 p) k k=1 (defiitio, first term is 0) ( 1)! = p (k 1)!( k)! pk 1 (1 p) k (reducig ad factorig) k=1 ( ) 1 = p p k 1 (1 p) k (rearragig) k 1 k=1 1 ( ) 1 = p p k (1 p) ( 1) k (reidexig) k k=0 = p (p + (1 p)) 1 (biomial theorem) = p. (simplifyig) Give X is a biomial radom variable, use idicator radom vairables to prove E[X] = p. Let X k, for k = 0, 1,..., be the idicator radom variable evaluatig to 1 if there are k successes, ad evaluatig to 0 otherwise. By Lemma 5.1 (o page 118 of CLRS), we have that E[X k ] = p, so the [ ] E[X] = E X k = E[X k ] = p = p. k=0 k=0 k= (p.1) Use idicator radom variables to compute the expected value of the sum of dice. For each die, let X k, for k = 1,, 3, 4, 5, 6 be the idicator radom variable evaluatig to 1 if the umber k is rolled, ad evaluatig to 0 otherwise. Let X be the radom variable evaluatig to the umber rolled o the die. It is clear that E[X k ] = 1/6 for all k, assumig the dice are fair. For every roll, the expected value is E[X] = 1 E[X 1 ] E[X 6 ] = Hece the expected value for rolls is E[X] = E[X] = 7. = 1 6 = 7. 1
2 .3-1 (p.37) Usig Figure.4 as a model, illustrate the operatio of merge sort o the array A = 3, 41, 5, 6, 38, 57, 9, 49. We follow the diagram i Figure.4 with the give sequece. sorted sequece 3, 9, 6, 38, 41, 49, 5, 57 merge 3, 6, 41, 5 9, 38, 49, 57 merge merge 3, 41 6, 5 38, 57 9, 49 merge merge merge merge iitial sequece.3- (p.37) Rewrite the Merge procedure so that it does ot use setiels, istead stoppig oce either array L or R has had all its elemets copied back to A ad the copyig the remaider of the other array back ito A. The followig is oe versio of such a rewrite. adjustmet of the for loop o lie 1. The mai differece is the removal of lies 8 ad 9, ad the 1 1 = q p + 1 = r q 3 let L[1,..., 1 ] ad R[1,..., ] be ew arrays 4 for i = 1 to 1 5 L[i] = A[p + i 1] 6 for j = 1 to 7 R[j] = A[q + j] 8 i = 1 9 j = 1 10 k = p 11 while i ad j if L[i] R[j] 13 A[k] = L[i] 14 i = i else 16 A[k] = R[j] 17 j = j k = k if i = ad j A[k,..., r] = R[j,..., ] 1 else if j = + 1 ad i + 1 A[k,..., r] = L[i,..., 1 ] Note that L ad R may be the same legth, so to ot raise a error, a else if commad has to be used istead of else. The differece is that else followig a if is evaluated if the if fails, whereas to coditio of else if followig a if is checked before evaluated. We could have used two if commads, but the secod oe will be checked eve if the first oe evaluates to true, icreasig ruig time.
3 .3-3 (p.39) Use mathematical iductio to show that whe is a exact power of, the solutio of the recurrece is T () = log (). T () = { if =, T (/) + if = k, for k > 1 I the base case = we see that T () = by what is give, ad T () = log () = by what is expected. Hece the base case holds. For the iductive case, whe = k for k, we have that T ( k ) = T ( k 1 ) + k = k 1 log ( k 1 ) + k = k (k 1) + k = k k = log (), as desired..3-6 (p.39) Observe that the while loop of lies 5-7 of the Isertio-sort procedure i Sectio.1 uses a liear search to sca (backward) through the sorted subarray A[1.. j 1]. Ca we use a biary search (see Exercise.3-5) istead to improve the overall worst-case ruig time of isertio sort to Θ( log ())? No, because eve if we use biary search, the search must be doe for every elemet i the list, so the umber of times lie 5 is executed is still j= s j. While it may be true that s j t j, the sum is still up to, so we will get a quadratic factor of i the ruig time calculatio..4 a,b,c (p.41) Let A[1.. ] be a array of distict umbers. If i < j ad A[i] > A[j], the the pair (i, j) is called a iversio of A. a. List the five iversios of the array, 3, 8, 6, 1. b. What array with elemets from the set {1,,..., } has the most iversios? How may does it have? c. What is the relatioship betwee the ruig time of isertio sort ad the umber of iversios i the iput array? Justify your aswer. a. The five iversios of A are (1, 5), (, 5), (3, 4), (3, 5), ad (4, 5). b. The reverse ordered array, 1,...,, 1 has the most iversios, sice every pair (i, j) with i < j is a iversio. The umber of iversios are ( 1) + ( ) = 1 k=1 k = ( 1)/. c. For each j, the umber of iversios (i, j) is oe less tha t j from lie 5 i the code of isertio sort. Sice the oly lies to cotribute a term are oes with t j i the sums, if there are (for example) log () iversios, the the ruig time of ierstio sort will be O( log ()). However, sice terms cotributig to the ruig time come from lies ot cotaiig t j, o matter how small the umber of iversios, the ruig time will ever be less tha O(). 3
4 6 Fid the best-case ad worst-case time for the Bubble-Sort ad Better-Bubble-Sort algorithms give i class slides. The slides are posted o Piazza. Iclude the algorithms with your work. First we aalyze the algorithms, similarly to how it is doe i the book. Bubble-sort cost times 1 for m = A.legth dowto c 1 for i = 1 to m 1 c m= m 3 if A[i] > A[i + 1] c 3 m= m 1 4 swap(a[i], A[i + 1]) c 4 m= m 1 Better-Bubble-sort cost times 1 for m = A.legth dowto c 1 sorted = true c 1 3 for i = 1 to m 1 c 3 m= m 4 if A[i] > A[i + 1] c 4 m= m 1 5 swap(a[i], A[i + 1]) c 5 m= m 1 6 sorted = false c 6 m= m 1 7 if sorted = true c retur c 8 1 For bubble-sort, the best case is if the if loop is ever evaluated, so we get c 1 + c m= m + c 3 m= ( ( + 1) (m 1) = c 1 + c ) ( ) ( 1) 1 + c 3 = O( ). The worst case happes if if is true every time, ad lie 4 is evaluated every time. The the ruig time is c 1 +c m= m+c 3 m= m 1+c 4 m= ( ( + 1) (m 1) = c 1 +c ) ( ) ( ) ( 1) ( 1) 1 +c 3 +c 4 = O( ). For better-bubble-sort, the best case is if we hit lie 8 as soo as possible (i the first go through the for loop i lie 1) ad the if i lie 4 is ever evaluated. That would be a ruig time of c 1 + c + c 3 + c 4 ( 1) + c 7 + c 8 = O(). The worst case is similar to the worst case for bubble-sort, i fact it must be at least O( ), sice the code for bubble-sort is cotaied withi the code for better-bubble-sort. Sice oe of the times are cubic i, it must be that the ruig time for the worst case is also O( ). 7 Fid the best-case, worst-case ad average-case ruig ties for Isertio-Sort. Show all work ad explai ay assumptios that you use. Iclude the algorithm with your work. 8 Prove that x = x ad that x = x. From the defiitio of the floor ad ceilig fuctios, we have that x 1 < x x ad x x < x + 1 x x > x 1. Sice there is exactly oe iteger i the iterval ( x 1, x], ad both x ad x are itegers i this rage, it must be that x = x. A aalogous argummet works for the secod part. 4
5 7.1-1 (p.173) Usig Figure 7.1 as a model, illustrate the operatio of Partitio o the array A = 13, 19, 9, 5, 1, 8, 7, 4, 1,, 6, 11. We follow Figure 7.1 with the give array. Step 0 has the array i the give order, ad step 11 has the array i the fial order. i p, j r step i p j r step i p j r step i, p j r step step step step step step step step p i r step p i r step The procedure returs the idex value i + 1 = p
6 7.1- (p.174) What value of q does Partitio retur whe all elemets i the array A[p.. r] have the same value? Modify Partitio so that q = (p + r)/ whe all elemets i the array A[p.. r] have the same value. If all the elemets i the array have the same value, the Partitio will retur the idex r, because the if coditio o lie 4 will always be true, ad so the value of i will be icreased r p times, ad sice i starts out at p 1, we have that p 1 + r p = r 1. Out of the for loop the value of i + 1 = r = r is retured. Here is oe way of modifyig the Partitio algorithm - by keepig a variable that is chaged oly if a differet value from A[r] is ecoutered. 1 x = A[r] i = p 1 3 same = true 4 for j = p to r 1 5 if A[j] x 6 i = i exchage A[i] with A[j] 8 if A[j] < x 9 same = false 10 exchage A[i + 1] with A[r] 11 if same 1 retur (p + r)/ 13 else 14 retur i (p.174) Give a brief argumet that the ruig time of Partitio o a subarray of size is Θ(). Every for ad while loop (usually) icreases ruig time by a factor of or log() (either way, a o-costat fuctio of ), ad i Partitio we oly have oe for loop. The lie o which the for loop appears is executed r p times, which is the legth of the subarray beig cosidered. The lies outside the for loop are executed eactly oce ad the lies iside the for loop are also executed at most r p 1 = 1 times. This meas the ruig time is a + b = Θ() for some appropriate costats a ad b (p.174) How would you modify Quicksort to sort ito oicreasig order? Here is oe way of modifyig the Quicksort algorithm - by switchig the iequality i lie 5 of Partitio the other way: 5 if A[j] x 5 if A[j] > x Leavig the rest of the code aloe, this puts all values greater tha A[r] o the left of A[q] at the ed, ad all values less tha or equal to A[r] o the right of A[q]. Aother method (which oly chages Quicksort ad ot Partitio) is swappig the two groups after Partitio is doe with them: 1 if p < r q = Partitio(A, p, r) 3 exchage A[p,..., q 1] with A[q + 1,..., r] 4 q = r (q p) 5 Quicksort(A, p, q 1) 6 Quicksort(A, q + 1, r) Note it is ot ecessary to swap the parts after the last executio of the ested Quicksort, because the there is oly oe elemet i the subarray, so there is othig to swap. 6
7 7-3 (p.187) A alterative aalysis of the ruig time of radomized quicksort focuses o the expected ruig time of each idividual recursive call to Radomized-Quicksort, rather tha o the umber of comparisos performed. a. Argue that, give a array of size, the probability that ay particular elemet is chose as the pivot is 1/. Use this to defie idicator radom variables X i = I{ith smallest elemet is chose as the pivot}. What is E[X i ]? b. Let T () be a radom variable deotig the ruig time of quicksort o a array of size. Argue that [ ] E[T ()] = E X q (T (q 1) + T ( q) + Θ()). c. Show that we ca rewrite equatio (7.5) as d. Show that E[T ()] = 1 E[T (q)] + Θ(). q= 1 k log (k) 1 log () 1 8. k= Hit: Split the summatio ito two parts, oe for k =, 3,..., / 1 ad oe for k = /,..., 1. e. Usig the boud from equatio (7.7), show that the recurrece i equatio (7.6) has the solutio E[T ()] = Θ( log ()). Hit: Show, by substitutio, that E[T ()] a log () for sufficietly large ad for some positive costat a. a. Sice the pivot is chose at radom from the array, every elemet has the same probability of beig chose. This meas each elemet has probability 1/ of beig chose. By Lemma 5.1, we kow that for a idicator variable X A evaluatig to 1 if evet A occurs ad 0 otherwise, E[X] = Pr(A). Sice the ith smallest elemet of the array is just oe specific elemet, we have that E[X i ] = 1/ for all i. b. Previously we argued that Partitio has ruig time Θ(). If idex q is chose as the pivot, the we immediately see that E[T ()] = E[Θ() + T (q 1) + T ( q)] by the code of Quicksort. Sice the idicator vairbale X q is 1 oly if q is chose as the pivot, we may cover all the possibilities by summig over all q ad multiplyig each term by X q, givig the desired form. c. Equatio (7.5) is the equatio from part b. above, ad simplifyig it is just algebra. [ ] E[T ()] = E X q (T (q 1) + T ( q) + Θ()) = = = 1 = 1 (give) E [X q (T (q 1) + T ( q) + Θ())] (liearity of E) E [X q ] E [T (q 1) + T ( q) + Θ())] E [T (q 1) + T ( q) + Θ())] E[Θ()] + 1 = Θ() + 1 = Θ() + = Θ() + (idepedece of X q ad T ()) (part a. above) (E [T (q 1)] + E [T ( q)]) (liearity of Σ ad E) (E [T (q 1)] + E [T ( q)]) (Θ is ot a radom variable) E [T (q 1)] (sice q 1 = ( (q 1))) E[T (0)] + E[T (1)] + E [T (q 1)] q=3 7
8 = Θ() + E [T (q 1)] q=3 = Θ() + 1 E [T (q)] q= (T (0), T (1) have liear ruig time) (reidexig) I the secod lie from the bottom the ruig times T (0) ad T (1) are absorbed ito the Θ(), ad as followig the algorithm we do approximately executios. d. This part is also just algebra. We follow the hit to get 1 k log (k) = k= / 1 k= / 1 k= k log (k) + k log (/) + 1 k= / 1 k= / / 1 = log (/) k + log () k= k log (k) 1 / 1 = log () k log () k k= ) 1 ( ( 1) = log () ( ( 1) log () 1 k= k log () 1 k= / ( ( 1 ) ( ( 1) ) 1 k 1 ) = log () 8 8 = 1 log () 1 ( 8 log () + log () + ) ) (takig the hit) (boudig above) (factorig) (laws of logarithms) (sum formula) (boudig above) 1 log () 1 8. Note i the secod-to-last lie the last term is positive for all positive itegers, so addig it simply bouds the origial expressio from above. e. Applyig substitutio, we guess that E[T ()] a log () for sufficietly large ad for some positive costat a. Pluggig this ito the results from parts c. ad d. above, we get E[T ()] = 1 E[T (q)] + Θ() q= (part c. above) = 1 aq log (q) + Θ() (guessig the result) q= a ( 1 log () 1 ) 8 + Θ() (part d. above) = a log () a 4 + Θ() a log () = Θ( log ()). (for a large eough) Note that Θ() Θ( log ()), but by makig a large eough, the term a/4 cacels the effect of ay costat fuctio b Θ(). 8
9 11 Fid a big-o for Quicksort for the followig three cases: a. a pre-sorted array; b. a reverse pre-sorted array; c. a array with all equal elemets. Cosider a situatio where the recursive calls to Quicksort alterate good case, bad case, good case, bad case, etc. Uder what coditios could this possibly happe? 9
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 informationCS 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 informationCS 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 information4.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 informationAnalysis 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 informationRecurrence 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 informationAverage-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 informationTest 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 informationAnalysis 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 informationCS: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 informationSorting 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 informationRandomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)
Radomized Algorithms I, Sprig 08, Departmet of Computer Sciece, Uiversity of Helsiki Homework : Solutios Discussed Jauary 5, 08). Exercise.: Cosider the followig balls-ad-bi game. We start with oe black
More informationThis 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 informationCS583 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 informationRecursive 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 informationDesign 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 informationComplex Numbers Solutions
Complex Numbers Solutios Joseph Zoller February 7, 06 Solutios. (009 AIME I Problem ) There is a complex umber with imagiary part 64 ad a positive iteger such that Fid. [Solutio: 697] 4i + + 4i. 4i 4i
More informationAn 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 informationDivide & 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 informationProblem Set 2 Solutions
CS271 Radomess & Computatio, Sprig 2018 Problem Set 2 Solutios Poit totals are i the margi; the maximum total umber of poits was 52. 1. Probabilistic method for domiatig sets 6pts Pick a radom subset S
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
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 informationMathematical Induction
Mathematical Iductio Itroductio Mathematical iductio, or just iductio, is a proof techique. Suppose that for every atural umber, P() is a statemet. We wish to show that all statemets P() are true. I a
More informationMatriculation 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 information6.3 Testing Series With Positive Terms
6.3. TESTING SERIES WITH POSITIVE TERMS 307 6.3 Testig Series With Positive Terms 6.3. Review of what is kow up to ow I theory, testig a series a i for covergece amouts to fidig the i= sequece of partial
More informationITEC 360 Data Structures and Analysis of Algorithms Spring for n 1
ITEC 360 Data Structures ad Aalysis of Algorithms Sprig 006 1. Prove that f () = 60 + 5 + 1 is Θ ( ). 60 + 5 + 1 60 + 5 + = 66 for 1 Take C 1 = 66 f () = 60 + 5 + 1 is O( ) Sice 60 + 5 + 1 60 for 1 If
More informationMath 299 Supplement: Real Analysis Nov 2013
Math 299 Supplemet: Real Aalysis Nov 203 Algebra Axioms. I Real Aalysis, we work withi the axiomatic system of real umbers: the set R alog with the additio ad multiplicatio operatios +,, ad the iequality
More information4.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(b) What is the probability that a particle reaches the upper boundary n before the lower boundary m?
MATH 529 The Boudary Problem The drukard s walk (or boudary problem) is oe of the most famous problems i the theory of radom walks. Oe versio of the problem is described as follows: Suppose a particle
More informationAlgebra of Least Squares
October 19, 2018 Algebra of Least Squares Geometry of Least Squares Recall that out data is like a table [Y X] where Y collects observatios o the depedet variable Y ad X collects observatios o the k-dimesioal
More informationOPTIMAL 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 informationCSI 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 informationAlgorithm 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 informationSNAP Centre Workshop. Basic Algebraic Manipulation
SNAP Cetre Workshop Basic Algebraic Maipulatio 8 Simplifyig Algebraic Expressios Whe a expressio is writte i the most compact maer possible, it is cosidered to be simplified. Not Simplified: x(x + 4x)
More informationCOMP285 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 informationThe Boolean Ring of Intervals
MATH 532 Lebesgue Measure Dr. Neal, WKU We ow shall apply the results obtaied about outer measure to the legth measure o the real lie. Throughout, our space X will be the set of real umbers R. Whe ecessary,
More informationOptimally 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 informationNUMERICAL 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 informationMath 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 informationIt is always the case that unions, intersections, complements, and set differences are preserved by the inverse image of a function.
MATH 532 Measurable Fuctios Dr. Neal, WKU Throughout, let ( X, F, µ) be a measure space ad let (!, F, P ) deote the special case of a probability space. We shall ow begi to study real-valued fuctios defied
More informationDepartment 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 informationCSE 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 informationClassification 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 informationMATH 304: MIDTERM EXAM SOLUTIONS
MATH 304: MIDTERM EXAM SOLUTIONS [The problems are each worth five poits, except for problem 8, which is worth 8 poits. Thus there are 43 possible poits.] 1. Use the Euclidea algorithm to fid the greatest
More informationMATH 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 informationAxioms of Measure Theory
MATH 532 Axioms of Measure Theory Dr. Neal, WKU I. The Space Throughout the course, we shall let X deote a geeric o-empty set. I geeral, we shall ot assume that ay algebraic structure exists o X so that
More informationw (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 informationInfinite Sequences and Series
Chapter 6 Ifiite Sequeces ad Series 6.1 Ifiite Sequeces 6.1.1 Elemetary Cocepts Simply speakig, a sequece is a ordered list of umbers writte: {a 1, a 2, a 3,...a, a +1,...} where the elemets a i represet
More informationDisjoint set (Union-Find)
CS124 Lecture 7 Fall 2018 Disjoit set (Uio-Fid) For Kruskal s algorithm for the miimum spaig tree problem, we foud that we eeded a data structure for maitaiig a collectio of disjoit sets. That is, we eed
More information1 Approximating Integrals using Taylor Polynomials
Seughee Ye Ma 8: Week 7 Nov Week 7 Summary This week, we will lear how we ca approximate itegrals usig Taylor series ad umerical methods. Topics Page Approximatig Itegrals usig Taylor Polyomials. Defiitios................................................
More information1. By using truth tables prove that, for all statements P and Q, the statement
Author: Satiago Salazar Problems I: Mathematical Statemets ad Proofs. By usig truth tables prove that, for all statemets P ad Q, the statemet P Q ad its cotrapositive ot Q (ot P) are equivalet. I example.2.3
More informationData 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 informationA 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 informationMAT1026 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 informationTopic 1 2: Sequences and Series. A sequence is an ordered list of numbers, e.g. 1, 2, 4, 8, 16, or
Topic : Sequeces ad Series A sequece is a ordered list of umbers, e.g.,,, 8, 6, or,,,.... A series is a sum of the terms of a sequece, e.g. + + + 8 + 6 + or... Sigma Notatio b The otatio f ( k) is shorthad
More informationHOMEWORK 2 SOLUTIONS
HOMEWORK SOLUTIONS CSE 55 RANDOMIZED AND APPROXIMATION ALGORITHMS 1. Questio 1. a) The larger the value of k is, the smaller the expected umber of days util we get all the coupos we eed. I fact if = k
More informationReal Variables II Homework Set #5
Real Variables II Homework Set #5 Name: Due Friday /0 by 4pm (at GOS-4) Istructios: () Attach this page to the frot of your homework assigmet you tur i (or write each problem before your solutio). () Please
More informationMA131 - 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 informationLinear chord diagrams with long chords
Liear chord diagrams with log chords Everett Sulliva Departmet of Mathematics Dartmouth College Haover New Hampshire, U.S.A. everett..sulliva@dartmouth.edu Submitted: Feb 7, 2017; Accepted: Oct 7, 2017;
More informationRead 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 informationSequences, 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 informationBertrand s Postulate
Bertrad s Postulate Lola Thompso Ross Program July 3, 2009 Lola Thompso (Ross Program Bertrad s Postulate July 3, 2009 1 / 33 Bertrad s Postulate I ve said it oce ad I ll say it agai: There s always a
More informationIntegrable Functions. { f n } is called a determining sequence for f. If f is integrable with respect to, then f d does exist as a finite real number
MATH 532 Itegrable Fuctios Dr. Neal, WKU We ow shall defie what it meas for a measurable fuctio to be itegrable, show that all itegral properties of simple fuctios still hold, ad the give some coditios
More informationRADICAL 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 informationA 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 informationDesign 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 informationYou 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 informationINTEGRATION BY PARTS (TABLE METHOD)
INTEGRATION BY PARTS (TABLE METHOD) Suppose you wat to evaluate cos d usig itegratio by parts. Usig the u dv otatio, we get So, u dv d cos du d v si cos d si si d or si si d We see that it is ecessary
More informationSequences and Series of Functions
Chapter 6 Sequeces ad Series of Fuctios 6.1. Covergece of a Sequece of Fuctios Poitwise Covergece. Defiitio 6.1. Let, for each N, fuctio f : A R be defied. If, for each x A, the sequece (f (x)) coverges
More informationThe Growth of Functions. Theoretical Supplement
The Growth of Fuctios Theoretical Supplemet The Triagle Iequality The triagle iequality is a algebraic tool that is ofte useful i maipulatig absolute values of fuctios. The triagle iequality says that
More informationENGI Series Page 6-01
ENGI 3425 6 Series Page 6-01 6. Series Cotets: 6.01 Sequeces; geeral term, limits, covergece 6.02 Series; summatio otatio, covergece, divergece test 6.03 Stadard Series; telescopig series, geometric series,
More informationAlgorithms 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 informationSummary: CORRELATION & LINEAR REGRESSION. GC. Students are advised to refer to lecture notes for the GC operations to obtain scatter diagram.
Key Cocepts: 1) Sketchig of scatter diagram The scatter diagram of bivariate (i.e. cotaiig two variables) data ca be easily obtaied usig GC. Studets are advised to refer to lecture otes for the GC operatios
More informationSequences 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 informationSeunghee 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 informationOn a Smarandache problem concerning the prime gaps
O a Smaradache problem cocerig the prime gaps Felice Russo Via A. Ifate 7 6705 Avezzao (Aq) Italy felice.russo@katamail.com Abstract I this paper, a problem posed i [] by Smaradache cocerig the prime gaps
More informationChapter 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 informationCHAPTER 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 informationCS 330 Discussion - Probability
CS 330 Discussio - Probability March 24 2017 1 Fudametals of Probability 11 Radom Variables ad Evets A radom variable X is oe whose value is o-determiistic For example, suppose we flip a coi ad set X =
More informationLesson 10: Limits and Continuity
www.scimsacademy.com Lesso 10: Limits ad Cotiuity SCIMS Academy 1 Limit of a fuctio The cocept of limit of a fuctio is cetral to all other cocepts i calculus (like cotiuity, derivative, defiite itegrals
More informationMIDTERM 3 CALCULUS 2. Monday, December 3, :15 PM to 6:45 PM. Name PRACTICE EXAM SOLUTIONS
MIDTERM 3 CALCULUS MATH 300 FALL 08 Moday, December 3, 08 5:5 PM to 6:45 PM Name PRACTICE EXAM S Please aswer all of the questios, ad show your work. You must explai your aswers to get credit. You will
More informationMath 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 informationMath 451: Euclidean and Non-Euclidean Geometry MWF 3pm, Gasson 204 Homework 3 Solutions
Math 451: Euclidea ad No-Euclidea Geometry MWF 3pm, Gasso 204 Homework 3 Solutios Exercises from 1.4 ad 1.5 of the otes: 4.3, 4.10, 4.12, 4.14, 4.15, 5.3, 5.4, 5.5 Exercise 4.3. Explai why Hp, q) = {x
More informationRademacher Complexity
EECS 598: Statistical Learig Theory, Witer 204 Topic 0 Rademacher Complexity Lecturer: Clayto Scott Scribe: Ya Deg, Kevi Moo Disclaimer: These otes have ot bee subjected to the usual scrutiy reserved for
More informationChapter 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 information1 of 7 7/16/2009 6:06 AM Virtual Laboratories > 6. Radom Samples > 1 2 3 4 5 6 7 6. Order Statistics Defiitios Suppose agai that we have a basic radom experimet, ad that X is a real-valued radom variable
More informationMATH 472 / SPRING 2013 ASSIGNMENT 2: DUE FEBRUARY 4 FINALIZED
MATH 47 / SPRING 013 ASSIGNMENT : DUE FEBRUARY 4 FINALIZED Please iclude a cover sheet that provides a complete setece aswer to each the followig three questios: (a) I your opiio, what were the mai ideas
More informationsin(n) + 2 cos(2n) n 3/2 3 sin(n) 2cos(2n) n 3/2 a n =
60. Ratio ad root tests 60.1. Absolutely coverget series. Defiitio 13. (Absolute covergece) A series a is called absolutely coverget if the series of absolute values a is coverget. The absolute covergece
More informationJoe Holbrook Memorial Math Competition
Joe Holbrook Memorial Math Competitio 8th Grade Solutios October 5, 07. Sice additio ad subtractio come before divisio ad mutiplicatio, 5 5 ( 5 ( 5. Now, sice operatios are performed right to left, ( 5
More information4.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 informationDiscrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 22
CS 70 Discrete Mathematics for CS Sprig 2007 Luca Trevisa Lecture 22 Aother Importat Distributio The Geometric Distributio Questio: A biased coi with Heads probability p is tossed repeatedly util the first
More informationHashing and Amortization
Lecture Hashig ad Amortizatio Supplemetal readig i CLRS: Chapter ; Chapter 7 itro; Sectio 7.. Arrays ad Hashig Arrays are very useful. The items i a array are statically addressed, so that isertig, deletig,
More informationMath 25 Solutions to practice problems
Math 5: Advaced Calculus UC Davis, Sprig 0 Math 5 Solutios to practice problems Questio For = 0,,, 3,... ad 0 k defie umbers C k C k =! k!( k)! (for k = 0 ad k = we defie C 0 = C = ). by = ( )... ( k +
More informationApplication to Random Graphs
A Applicatio to Radom Graphs Brachig processes have a umber of iterestig ad importat applicatios. We shall cosider oe of the most famous of them, the Erdős-Réyi radom graph theory. 1 Defiitio A.1. Let
More informationECE-S352 Introduction to Digital Signal Processing Lecture 3A Direct Solution of Difference Equations
ECE-S352 Itroductio to Digital Sigal Processig Lecture 3A Direct Solutio of Differece Equatios Discrete Time Systems Described by Differece Equatios Uit impulse (sample) respose h() of a DT system allows
More informationCS 171 Lecture Outline October 09, 2008
CS 171 Lecture Outlie October 09, 2008 The followig theorem comes very hady whe calculatig the expectatio of a radom variable that takes o o-egative iteger values. Theorem: Let Y be a radom variable that
More information18.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 informationAdvanced 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 informationSolutions to Math 347 Practice Problems for the final
Solutios to Math 347 Practice Problems for the fial 1) True or False: a) There exist itegers x,y such that 50x + 76y = 6. True: the gcd of 50 ad 76 is, ad 6 is a multiple of. b) The ifiimum of a set is
More informationData 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 informationAlgebra II Notes Unit Seven: Powers, Roots, and Radicals
Syllabus Objectives: 7. The studets will use properties of ratioal epoets to simplify ad evaluate epressios. 7.8 The studet will solve equatios cotaiig radicals or ratioal epoets. b a, the b is the radical.
More information