Test One (Answer Key)

Size: px
Start display at page:

Download "Test One (Answer Key)"

Transcription

1 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) questios o five (5) pages. Please put your ame o each page of this examiatio. Aswer Some of these aswers have far more detail tha was required from the test questio. For example, there are questios that ask for oly the recurrece, but the aswer has a full solutio. This is to help yo use this aswer key to prepare for future exams.

2 CS395/Ma395 (Sprig 2005) Test Oe Name: Page 2 Questio 1 [6 poits] Prove or disprove each of the followig: 1. log Ω( 2 ) 2. 3 Θ(2 ) ( + 2) 2 O( 4 ) Aswer log lim 2 log = lim = lim 1 = 0 (by simple maipulatios ad L Hôpitals rule) ad so log O( 2 ), but log Ω( 2 ). 3 ( ) 3 lim 2 = lim = 2 So 2 O(3 ), but 2 Ω(3 ) ad hece 3 Θ(2 ). ( + 2) 2 = By the max rule, this is i O( 2 ), ad O( 2 ) O( 4 ) sice lim 2 1 lim = 0. 2 So ( + 2) 2 O( 4 ), but ( + 2) 2 Ω( 4 ). 4 = Questio 2 [5 poits] Show that the fuctio f() = 2 is 2-smooth. Aswer We eed to show that f() is evetually o-decreasig, ad that f(2) O(f()), where f() = 2. f() = = ( + 1) 2 = f( + 1) for all 0, so f is clearly evetually odecreasig. Also, f(2) = (2) 2 = 4 2 O( 2 ) sice oe ca igore the costat factor of 4.

3 CS395/Ma395 (Sprig 2005) Test Oe Name: Page 3 Questio 3 [10 poits] Suppose algorithm Foo() has 2 istaces of size (for ay ) ad it requires steps for 2 1 of them, ad 2 + steps for the oe remaiig istace. What is the average case complexity of Foo()? Aswer It is the average umber of steps required for all istaces of size, which is ( (2 1)) + (2 + ) = = So the umber of steps i the average case, assumig all iput istaces equally likely, is Θ() far better tha the worst case behavior of Θ(2 ). Questio 4 [10 poits] Suppose that algorithm Bar() uses at most Θ(2 ) i the worst case, but that k repetitios of Bar() always requires Θ(3k) time. What is the worst case ad amortized complexity of Foo()? Aswer Worst case is, by defiitio, Θ(2 ). But amortized complexity is Θ(3k/k) = Θ(1), per ivocatio. Questio 5 [5 poits] Suppose the algorithm MyAlg is O( 2 is a power of 2). What ca you say about the complexity of MyAlg, give the results of questio 2? Aswer We eed to show that f(2) O(f()), where f() = 2. But f(2) = (2) 2 = 4 2 O( 2 ) sice oe ca igore the costat factor of 4.

4 CS395/Ma395 (Sprig 2005) Test Oe Name: Page 4 Questio 6 [10 poits] Express the complexity of the followig algorithm as a recurrece relatio (do ot solve the recurrece!) Procedure fu(); { if ( > 0) { LoadsOfFu = 0; for i = 1 to { LoadsOfFu++; } retur (fu(/2) + fu(/2) + LoadsOfFu); // / is iteger divisio } else retur 1; } Aswer Let T () be the time for this algorithm i iput. The the time required is T () = + 2T (/2) + c This is the time for the loop, ad for the two recursive calls. It assumes that additio ad multiplicatio are elemetary operatios, ad that the istaces sizes are the values of. Questio 7 [4 poits] Suppose you test algorithm Foo o all iputs up to size = 10, ad it requires time as follows: Time Ca you coclude that Foo is i Θ(2 )? Why or why ot? Aswer No, you caot. Asymptotic otatio is expressed i terms of behavior for sufficietly large. We have o assurace that = 10 is large eough these could all be special cases for the algorithm. Besides, you caot aalyze a algorithm from empirical behavior, that is aalyzig a process, ot a algorithm.

5 CS395/Ma395 (Sprig 2005) Test Oe Name: Page 5 Questio 8 [10 poits] Aalyze the worst case complexity of the followig algorithm. Procedure Foo(); { for i = 1 to do { for j = 1 to do { for k = j to do { cout << "Hello!"; } } } } Aswer The barometer will be the umber of Hello messages prited, ad we assume all operatios are uit time. The cout << will execute oce for every selectio of i,j,k, regardless of their order (sice oly oe order, amely i < j < k is relevat). There are O( ( ) 3 ) = O( 3 ) ways for this to happe. Or, otice that the two ier loops produce + ( 1) = i=1 = ( + 1)/2 couts. These two loops get executed times, so the total umber of couts is ( + 1)/2 = ( )/2 Θ( 3 ) total. Alteratively, make a table of the possible values for the three idex variables: i j k

6 CS395/Ma395 (Sprig 2005) Test Oe Name: Page 6 Questio 9 [10 poits] What is the characteristic polyomial for the followig recurrece? Aswer This yields t = 6t 1 9t t 6t 1 + 9t 2 = 2 The characteristic polyomial for this recurrece is (x 2 6x + 9)(x 2) 2 = (x 3) 2 (x 2) 2 Questio 10 [10 poits] The recurrece t +1 5t +6 = 2 has a characteristic polyomial of (x 3)(x 2) 3 What is the closed form for this recurrece? Aswer This has root 3 with multiplicity 1 ad root 2 with multiplicity 3, so the closed form solutio is t = c c c c for some costats c 0, c 1, c 2, ad c 3. This is clearly O(3 ).

7 CS395/Ma395 (Sprig 2005) Test Oe Name: Page 7 Questio 11 [10 poits] prove that the ith biomial tree, B i, has 2 i odes. Aswer The proof is by recursio o i. Base case (i = 0). B 0 has 1 ode by defiitio, ad 1 = 2 0. Assume the ith biomial tree has 2 i odes for 0 i k, ad prove that B k+1 has 2 k+1 odes. The umber of odes i B k+1 is oe, for the root, plus oe for each subtree of the root. By defiitio, these subtrees are B 0, B 1... B k. So, usig the iductive assumptio, B k+1 has k = 1+(2 k+1 1) = 2 k+1 odes, which was to be show. May people oticed that is is possible to defie biomial trees a differet way. Our defiitio i class was: B 0 is a sigle ode, B i+1 is a root ode with each of B 0... B i as a subtree. The above proof follows that defiitio. Alteratively, oe ca defie biomial trees as follows: B 0 is a sigle ode, B i+1 is B i with a copy of B i added as a subtree to the root of the first B i. Note that these are differet defiitios, but they defie the same objects (the proof of that fact is a good exercise, do t just take it for grated! The proof is by iductio.) Give this secod defiitio, oe ca prove that B i has 2 i odes as follows: Base case (i = 0). B 0 has a sigle ode by defiitio, ad 1 = 2 0. Assume the ith biomial tree has 2 k odes, ad prove that B k+1 has 2 k+1 odes. The umber of odes i B k+1 by defiitio is 2 2 k, usig the iductive assumptio, sice B k+1 comprises two copies of B k. But 2 2 k = 2 k+1, which was to be show. This ca also be prove, rather cleverly, by expressig the size of B i as a recurrece: s(0) = 1 ad s(i + 1) = 2s(i). Oe ca the solve this recurrece. The characteristic polyomial is: x 2 = 0, which has a closed form of c c 2 = 0. Solvig for the costats, give the iitial coditio (which is ecessary i this case) gives that c 2 = 0 ad c 1 = 1. So, the closed form for the recurrece is s(i) = 2 i, which was to be show! Note: bioomial trees are ot the same thig as biary trees. Several of you cofused the two, eve though I aouced durig the exam that the questio was ideed about the former!

8 CS395/Ma395 (Sprig 2005) Test Oe Name: Page 8 Questio 12 [10 poits] Why is the isert operatio for regular heaps (ot biomial heaps) a O(log ) operatio, whe the heap has elemets i it? Aswer Because regular heaps are essetially complete biary trees, ad so the height of the data structure is O(log ). The height of the structure is the maximum umber of data exchages required to move a elemet from the ext available slot to where it belogs, i order to restore the heap property. I gave extra credit for provig that the height of a full biary tree is log.

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

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

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

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

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

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

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

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

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

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

ITEC 360 Data Structures and Analysis of Algorithms Spring for n 1

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

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

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

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

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

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

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

Infinite Sequences and Series

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

6.3 Testing Series With Positive Terms

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

Homework 9. (n + 1)! = 1 1

Homework 9. (n + 1)! = 1 1 . Chapter : Questio 8 If N, the Homewor 9 Proof. We will prove this by usig iductio o. 2! + 2 3! + 3 4! + + +! +!. Base step: Whe the left had side is. Whe the right had side is 2! 2 +! 2 which proves

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

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

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

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

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

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

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

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

Math 113 Exam 4 Practice

Math 113 Exam 4 Practice Math Exam 4 Practice Exam 4 will cover.-.. 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

More information

Lesson 10: Limits and Continuity

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

CHAPTER I: Vector Spaces

CHAPTER I: Vector Spaces CHAPTER I: Vector Spaces Sectio 1: Itroductio ad Examples This first chapter is largely a review of topics you probably saw i your liear algebra course. So why cover it? (1) Not everyoe remembers everythig

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

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

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

Dynamic Programming. Sequence Of Decisions. 0/1 Knapsack Problem. Sequence Of Decisions 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

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

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

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

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

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

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

1. By using truth tables prove that, for all statements P and Q, the statement

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

SCORE. Exam 2. MA 114 Exam 2 Fall 2016

SCORE. Exam 2. MA 114 Exam 2 Fall 2016 MA 4 Exam Fall 06 Exam Name: Sectio ad/or TA: Do ot remove this aswer page you will retur the whole exam. You will be allowed two hours to complete this test. No books or otes may be used. You may use

More information

Real Variables II Homework Set #5

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

62. Power series Definition 16. (Power series) Given a sequence {c n }, the series. c n x n = c 0 + c 1 x + c 2 x 2 + c 3 x 3 +

62. Power series Definition 16. (Power series) Given a sequence {c n }, the series. c n x n = c 0 + c 1 x + c 2 x 2 + c 3 x 3 + 62. Power series Defiitio 16. (Power series) Give a sequece {c }, the series c x = c 0 + c 1 x + c 2 x 2 + c 3 x 3 + is called a power series i the variable x. The umbers c are called the coefficiets of

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

Math 10A final exam, December 16, 2016

Math 10A final exam, December 16, 2016 Please put away all books, calculators, cell phoes ad other devices. You may cosult a sigle two-sided sheet of otes. Please write carefully ad clearly, USING WORDS (ot just symbols). Remember that the

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

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

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 304: MIDTERM EXAM SOLUTIONS

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

Lecture Notes for CS 313H, Fall 2011

Lecture Notes for CS 313H, Fall 2011 Lecture Notes for CS 313H, Fall 011 August 5. We start by examiig triagular umbers: T () = 1 + + + ( = 0, 1,,...). Triagular umbers ca be also defied recursively: T (0) = 0, T ( + 1) = T () + + 1, or usig

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

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

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

10.1 Sequences. n term. We will deal a. a n or a n n. ( 1) n ( 1) n 1 2 ( 1) a =, 0 0,,,,, ln n. n an 2. n term.

10.1 Sequences. n term. We will deal a. a n or a n n. ( 1) n ( 1) n 1 2 ( 1) a =, 0 0,,,,, ln n. n an 2. n term. 0. Sequeces A sequece is a list of umbers writte i a defiite order: a, a,, a, a is called the first term, a is the secod term, ad i geeral eclusively with ifiite sequeces ad so each term Notatio: the sequece

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

CS 336. of n 1 objects with order unimportant but repetition allowed.

CS 336. of n 1 objects with order unimportant but repetition allowed. CS 336. The importat issue is the logic you used to arrive at your aswer.. Use extra paper to determie your solutios the eatly trascribe them oto these sheets. 3. Do ot submit the scratch sheets. However,

More information

SCORE. Exam 2. MA 114 Exam 2 Fall 2017

SCORE. Exam 2. MA 114 Exam 2 Fall 2017 Exam Name: Sectio ad/or TA: Do ot remove this aswer page you will retur the whole exam. You will be allowed two hours to complete this test. No books or otes may be used. You may use a graphig calculator

More information

Math F215: Induction April 7, 2013

Math F215: Induction April 7, 2013 Math F25: Iductio April 7, 203 Iductio is used to prove that a collectio of statemets P(k) depedig o k N are all true. A statemet is simply a mathematical phrase that must be either true or false. Here

More information

Math 113 Exam 3 Practice

Math 113 Exam 3 Practice Math Exam Practice Exam 4 will cover.-., 0. ad 0.. Note that eve though. was tested i exam, questios from that sectios may also be o this exam. For practice problems o., refer to the last review. This

More information

Mathematical Induction

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

Exam 2 CMSC 203 Fall 2009 Name SOLUTION KEY Show All Work! 1. (16 points) Circle T if the corresponding statement is True or F if it is False.

Exam 2 CMSC 203 Fall 2009 Name SOLUTION KEY Show All Work! 1. (16 points) Circle T if the corresponding statement is True or F if it is False. 1 (1 poits) Circle T if the correspodig statemet is True or F if it is False T F For ay positive iteger,, GCD(, 1) = 1 T F Every positive iteger is either prime or composite T F If a b mod p, the (a/p)

More information

Math 140A Elementary Analysis Homework Questions 3-1

Math 140A Elementary Analysis Homework Questions 3-1 Math 0A Elemetary Aalysis Homework Questios -.9 Limits Theorems for Sequeces Suppose that lim x =, lim y = 7 ad that all y are o-zero. Detarime the followig limits: (a) lim(x + y ) (b) lim y x y Let s

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

CHAPTER 1 SEQUENCES AND INFINITE SERIES

CHAPTER 1 SEQUENCES AND INFINITE SERIES CHAPTER SEQUENCES AND INFINITE SERIES SEQUENCES AND INFINITE SERIES (0 meetigs) Sequeces ad limit of a sequece Mootoic ad bouded sequece Ifiite series of costat terms Ifiite series of positive terms Alteratig

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

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

MA131 - Analysis 1. Workbook 2 Sequences I

MA131 - Analysis 1. Workbook 2 Sequences I MA3 - Aalysis Workbook 2 Sequeces I Autum 203 Cotets 2 Sequeces I 2. Itroductio.............................. 2.2 Icreasig ad Decreasig Sequeces................ 2 2.3 Bouded Sequeces..........................

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

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

sin(n) + 2 cos(2n) n 3/2 3 sin(n) 2cos(2n) n 3/2 a n =

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

In number theory we will generally be working with integers, though occasionally fractions and irrationals will come into play.

In number theory we will generally be working with integers, though occasionally fractions and irrationals will come into play. Number Theory Math 5840 otes. Sectio 1: Axioms. I umber theory we will geerally be workig with itegers, though occasioally fractios ad irratioals will come ito play. Notatio: Z deotes the set of all itegers

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

CSE 1400 Applied Discrete Mathematics Number Theory and Proofs

CSE 1400 Applied Discrete Mathematics Number Theory and Proofs CSE 1400 Applied Discrete Mathematics Number Theory ad Proofs Departmet of Computer Scieces College of Egieerig Florida Tech Sprig 01 Problems for Number Theory Backgroud Number theory is the brach of

More information

NATIONAL UNIVERSITY OF SINGAPORE FACULTY OF SCIENCE SEMESTER 1 EXAMINATION ADVANCED CALCULUS II. November 2003 Time allowed :

NATIONAL UNIVERSITY OF SINGAPORE FACULTY OF SCIENCE SEMESTER 1 EXAMINATION ADVANCED CALCULUS II. November 2003 Time allowed : NATIONAL UNIVERSITY OF SINGAPORE FACULTY OF SCIENCE SEMESTER EXAMINATION 003-004 MA08 ADVANCED CALCULUS II November 003 Time allowed : hours INSTRUCTIONS TO CANDIDATES This examiatio paper cosists of TWO

More information

MATH 10550, EXAM 3 SOLUTIONS

MATH 10550, EXAM 3 SOLUTIONS MATH 155, EXAM 3 SOLUTIONS 1. I fidig a approximate solutio to the equatio x 3 +x 4 = usig Newto s method with iitial approximatio x 1 = 1, what is x? Solutio. Recall that x +1 = x f(x ) f (x ). Hece,

More information

Basic Sets. Functions. MTH299 - Examples. Example 1. Let S = {1, {2, 3}, 4}. Indicate whether each statement is true or false. (a) S = 4. (e) 2 S.

Basic Sets. Functions. MTH299 - Examples. Example 1. Let S = {1, {2, 3}, 4}. Indicate whether each statement is true or false. (a) S = 4. (e) 2 S. Basic Sets Example 1. Let S = {1, {2, 3}, 4}. Idicate whether each statemet is true or false. (a) S = 4 (b) {1} S (c) {2, 3} S (d) {1, 4} S (e) 2 S. (f) S = {1, 4, {2, 3}} (g) S Example 2. Compute the

More information

Model Theory 2016, Exercises, Second batch, covering Weeks 5-7, with Solutions

Model Theory 2016, Exercises, Second batch, covering Weeks 5-7, with Solutions Model Theory 2016, Exercises, Secod batch, coverig Weeks 5-7, with Solutios 3 Exercises from the Notes Exercise 7.6. Show that if T is a theory i a coutable laguage L, haso fiite model, ad is ℵ 0 -categorical,

More information

The Discrete Fourier Transform

The Discrete Fourier Transform The Discrete Fourier Trasform Complex Fourier Series Represetatio Recall that a Fourier series has the form a 0 + a k cos(kt) + k=1 b k si(kt) This represetatio seems a bit awkward, sice it ivolves two

More information

Please do NOT write in this box. Multiple Choice. Total

Please do NOT write in this box. Multiple Choice. Total Istructor: Math 0560, Worksheet Alteratig Series Jauary, 3000 For realistic exam practice solve these problems without lookig at your book ad without usig a calculator. Multiple choice questios should

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

MATH301 Real Analysis (2008 Fall) Tutorial Note #7. k=1 f k (x) converges pointwise to S(x) on E if and

MATH301 Real Analysis (2008 Fall) Tutorial Note #7. k=1 f k (x) converges pointwise to S(x) on E if and MATH01 Real Aalysis (2008 Fall) Tutorial Note #7 Sequece ad Series of fuctio 1: Poitwise Covergece ad Uiform Covergece Part I: Poitwise Covergece Defiitio of poitwise covergece: A sequece of fuctios f

More information

HOMEWORK 2 SOLUTIONS

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

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

University of Colorado Denver Dept. Math. & Stat. Sciences Applied Analysis Preliminary Exam 13 January 2012, 10:00 am 2:00 pm. Good luck!

University of Colorado Denver Dept. Math. & Stat. Sciences Applied Analysis Preliminary Exam 13 January 2012, 10:00 am 2:00 pm. Good luck! Uiversity of Colorado Dever Dept. Math. & Stat. Scieces Applied Aalysis Prelimiary Exam 13 Jauary 01, 10:00 am :00 pm Name: The proctor will let you read the followig coditios before the exam begis, ad

More information

STAT Homework 1 - Solutions

STAT Homework 1 - Solutions STAT-36700 Homework 1 - Solutios Fall 018 September 11, 018 This cotais solutios for Homework 1. Please ote that we have icluded several additioal commets ad approaches to the problems to give you better

More information

Solutions to Final Exam

Solutions to Final Exam Solutios to Fial Exam 1. Three married couples are seated together at the couter at Moty s Blue Plate Dier, occupyig six cosecutive seats. How may arragemets are there with o wife sittig ext to her ow

More information

Randomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)

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

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

Sequences and Series of Functions

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

Fundamental Theorem of Algebra. Yvonne Lai March 2010

Fundamental Theorem of Algebra. Yvonne Lai March 2010 Fudametal Theorem of Algebra Yvoe Lai March 010 We prove the Fudametal Theorem of Algebra: Fudametal Theorem of Algebra. Let f be a o-costat polyomial with real coefficiets. The f has at least oe complex

More information

Problems with Solutions in the Analysis of Algorithms. Minko Markov

Problems with Solutions in the Analysis of Algorithms. Minko Markov Problems with Solutios i the Aalysis of Algorithms Miko Markov Draft date November 13, 014 Copyright c 010 014 Miko Markov All rights reserved. Maple is a trademark of Waterloo Maple Ic. Cotets I Backgroud

More information

Chapter 0. Review of set theory. 0.1 Sets

Chapter 0. Review of set theory. 0.1 Sets Chapter 0 Review of set theory Set theory plays a cetral role i the theory of probability. Thus, we will ope this course with a quick review of those otios of set theory which will be used repeatedly.

More information