Assignment 5 Bounding Complexities KEY

Similar documents
2. Limits at Infinity

Algorithms and Their Complexity

Growth of Functions (CLRS 2.3,3)

Announcements. CompSci 230 Discrete Math for Computer Science. The Growth of Functions. Section 3.2

Principles of Algorithm Analysis

Advanced Algorithmics (6EAP)

CSE 373: Data Structures and Algorithms. Asymptotic Analysis. Autumn Shrirang (Shri) Mare

Exploring Graphs of Polynomial Functions

MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 2

CS 344 Design and Analysis of Algorithms. Tarek El-Gaaly Course website:

Computational Complexity

CSC236 Week 3. Larry Zhang

Reading 10 : Asymptotic Analysis

Northwest High School s Algebra 1

How many hours would you estimate that you spent on this assignment?

An analogy from Calculus: limits

Growth of Functions. As an example for an estimate of computation time, let us consider the sequential search algorithm.

2, or x 5, 3 x 0, x 2

Northwest High School s Geometry

EECS 477: Introduction to algorithms. Lecture 5

Data Structures and Algorithms. Asymptotic notation

csci 210: Data Structures Program Analysis

Define Efficiency. 2: Analysis. Efficiency. Measuring efficiency. CSE 417: Algorithms and Computational Complexity. Winter 2007 Larry Ruzzo

CSE 421: Intro Algorithms. 2: Analysis. Winter 2012 Larry Ruzzo

Math 391: Midterm 1.0 Spring 2016

CSC Design and Analysis of Algorithms. Lecture 1

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2019

Math 1314 Lesson 4 Limits

CISC 235: Topic 1. Complexity of Iterative Algorithms

COMP 355 Advanced Algorithms

Defining Efficiency. 2: Analysis. Efficiency. Measuring efficiency. CSE 421: Intro Algorithms. Summer 2007 Larry Ruzzo

Welcome to the most exciting math class in high school! There are three major tasks you have to accomplish over the summer:

Analysis of Algorithms

Lecture 2. Fundamentals of the Analysis of Algorithm Efficiency

Northwest High School s Algebra 1

2.2 Asymptotic Order of Growth. definitions and notation (2.2) examples (2.4) properties (2.2)

Numerical Methods. Exponential and Logarithmic functions. Jaesung Lee

COMP 355 Advanced Algorithms Algorithm Design Review: Mathematical Background

Motion II. Goals and Introduction

Welcome to the most exciting math class in high school! There are three major tasks you have to accomplish over the summer:

Calculus Review Session. Rob Fetter Duke University Nicholas School of the Environment August 13, 2015

Assignment 2.1. Exponent Properties: The Product Rule

Asymptotic Notation. such that t(n) cf(n) for all n n 0. for some positive real constant c and integer threshold n 0

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2018

Mathematics Online Instructional Materials Correlation to the 2009 Algebra II Standards of Learning and Curriculum Framework

CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2018

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu

Lecture 2. More Algorithm Analysis, Math and MCSS By: Sarah Buchanan

The Time Complexity of an Algorithm

More Asymptotic Analysis Spring 2018 Discussion 8: March 6, 2018

csci 210: Data Structures Program Analysis

Algorithms Design & Analysis. Analysis of Algorithm

Big O 2/14/13. Administrative. Does it terminate? David Kauchak cs302 Spring 2013

CSE 417: Algorithms and Computational Complexity

Asymptotic Analysis of Algorithms. Chapter 4

Analysis of Algorithms [Reading: CLRS 2.2, 3] Laura Toma, csci2200, Bowdoin College

If a function has an inverse then we can determine the input if we know the output. For example if the function

The Time Complexity of an Algorithm

CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis. Riley Porter Winter 2017

Review Asympto&c Bounds

Asymptotic Analysis. Thomas A. Anastasio. January 7, 2004

CIS 121 Data Structures and Algorithms with Java Spring Big-Oh Notation Monday, January 22/Tuesday, January 23

CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis. Hunter Zahn Summer 2016

Asymptotic Analysis 1

Midterm Examination. STA 215: Statistical Inference. Due Wednesday, 2006 Mar 8, 1:15 pm

Menu. Lecture 2: Orders of Growth. Predicting Running Time. Order Notation. Predicting Program Properties

Algorithms, Design and Analysis. Order of growth. Table 2.1. Big-oh. Asymptotic growth rate. Types of formulas for basic operation count

Logarithmic and Exponential Equations and Change-of-Base

2. ALGORITHM ANALYSIS

CSC236 Week 4. Larry Zhang

Running Time Evaluation

COMP 182 Algorithmic Thinking. Algorithm Efficiency. Luay Nakhleh Computer Science Rice University

CS 380 ALGORITHM DESIGN AND ANALYSIS

Northwest High School s Algebra 1. Summer Review Packet

Data Structures and Algorithms

CS 4407 Algorithms Lecture 2: Growth Functions

Information Page. Desmos Graphing Calculator IXL Username: Password: gothunder

Math 111: Final Review

Geometry Summer Assignment 2018

Galaxy Metallicity: What Oxygen Tells Us About The Lifecycles of Galaxies Designed by Prof Jess Werk, modified by Marie Wingyee Lau

IM 3 Assignment 4.3 : Graph Investigation Unit 4 Polynomial Functions

We can see that f(2) is undefined. (Plugging x = 2 into the function results in a 0 in the denominator)

More on Asymptotic Running Time Analysis CMPSC 122

Definition of a Logarithm

1 Useful identities related to summations

Copyright 2000, Kevin Wayne 1

Analysis of Algorithms

with the size of the input in the limit, as the size of the misused.

This chapter covers asymptotic analysis of function growth and big-o notation.

3.1 Asymptotic notation

Announcements. CompSci 102 Discrete Math for Computer Science. Chap. 3.1 Algorithms. Specifying Algorithms

CS Data Structures and Algorithm Analysis

2.1 Computational Tractability. Chapter 2. Basics of Algorithm Analysis. Computational Tractability. Polynomial-Time

Algorithms. Grad Refresher Course 2011 University of British Columbia. Ron Maharik

Algorithm efficiency can be measured in terms of: Time Space Other resources such as processors, network packets, etc.

RATIONAL FUNCTIONS AND

Reteach Simplifying Algebraic Expressions

Semester Review Packet

Instructor Notes for Chapters 3 & 4

CSE 331 Winter 2018 Homework 1

Transcription:

Assignment 5 Bounding Complexities KEY Print this sheet and fill in your answers. Please staple the sheets together. Turn in at the beginning of class on Friday, September 16. There are links in the examples below that take you to the Desmos website and the Wolfram Math website, where these examples are shown graphically. Multiple functions are plotted in different colors. Use the key on the right of the webpage to determine the color for each function. We have also included the URLs of these links so you can copy/paste them if you are working from a pdf file. If you are working from a pdf file, the blue, underlined hyperlinks don t usually work. You have to copy/paste the URL into your browser. The link names we included are in black font and are underlined, but clicking on them does not take you to the website you have to copy/paste the URL into your browser. Complexity The worst case complexity of an algorithm (the maximum number of basic operations it might perform) is a function of the size of its input. So when comparing the complexity of algorithms, we are comparing functions. If we have two functions,, we can determine their relationship as their input sizes grow by looking at the ratio /. For example, 5, 2, / 5/2. The ratio of the two functions does not depend on the input size. So the algorithm whose complexity is requires 2.5 times more operations than the algorithm for no matter the size of n. Their complexities are within a constant factor of each other, even as n grows toward infinity. (Example URL: https://www.desmos.com/calculator/aui8zxkukn) Another example,,, /. Here function grows faster. The gap between them gets larger and larger as n grows. The gap in the complexities for the two algorithms with these complexities grows logarithmically with the input. As n grows toward infinity, so does the gap, and dwarfs. (Example URL: https://www.desmos.com/calculator/phn1qxhdwx) The relationships between functions we want to identify are: meaning that is an asymptotic upper bound on, within a constant factor. It is read as f of n is order g of n or f is big oh of g of n. meaning that is an asymptotic lower bound on, within a constant factor. It is read as f is big omega of g of n. meaning that is an asymptotically tight bound on, bounding it above and below within a constant factor. It is read as f is big theta of g of n. If and, then. Hence if, then there exist positive constants,, such that for all :

Additionally 1 there are: meaning that is an upper bound on that is not asymptotically tight. It is read as f is little oh of g of n. For example, 2, but 2. Where is analogous to, is analogous to. Hence if, then 0. meaning that is a lower bound on that is not asymptotically tight. It is read as f is little omega of g of n. For example,, but. If you think of as analogous to, then is analogous to. Hence if:, then. Instructions: Fill in the blanks with one of the five symbols (O, Ω, Θ, o, or ω) to indicate the relationship between the functions. 1. If, then = Ω_ 2. If, then = ω_ 3. Since, it is also true that = _O and = Ω _ Instructions: For these next two problems, fill in the first blank with the ratio of these two functions. Next determine what that implies about bounding and fill in the other blank(s) with one of the five symbols listed above. 4. If and, then / = _log 2 n, which means that = ω and = _ Ω 1 Some functions are not asymptotically comparable at all (URL: https://www.desmos.com/calculator/dz1cecgcmr)

5. If / and 75, then / = _1/75. This ratio means that = _Θ_ (Click here to see graphs of the functions and their ratios. URL: https://www.desmos.com/calculator/zsbmddwpda) Facts about exponents: 1/ / and if 0 if 0 The polynomial may start slow, (URL: https://www.desmos.com/calculator/g5geljqgja) but will overtake the log (URL: https://www.desmos.com/calculator/ppb3ddzm6i) eventually. See the approximate solutions (click here, URL: https://www.wolframalpha.com/input/?i=x%5e0.1+%3d+log_2(x) ) for. (try changing the function to. and see what happens this website is Wolfram Math, and you can change the function you want to plot near the top of the webpage) Instructions: For these problems, fill in the first blank with the ratio of these two functions. Next determine what that implies about bounding and fill in the other blanks with one of the five symbols (O, Ω, Θ, o, or ω). 6. If. and., then / = _n 0.1 _, which means that = _o and = _O 7. If. and, then / = _n 0.2 /log 2 n, which means that = ω and = Ω

Facts about exponential functions:, if c and d are constants such that 1, 0 Check out the solutions to 1. 1 (at this link, URL: https://www.wolframalpha.com/input/?i=1.1%5ex+%3d+x%5e2), 1.01 (at this link, URL: https://www.wolframalpha.com/input/?i=1.01%5ex+%3d+x%5e2), and 1.001 (at this link, URL: https://www.wolframalpha.com/input/?i=1.001%5ex+%3d+x%5e2) Instructions: Fill in the blanks with one of the five symbols (O, Ω, Θ, o, or ω) to indicate the relationship between the functions. 8. If 3 and, then = ω and = Ω Instructions: Fill in the first blank with the ratio of these two functions. Next determine what that implies about bounding and fill in the other blanks with one of the five symbols listed above. 9. If 2 and 3, then / = (2/3) n, which means that = _o and = _O

Facts about comparing sums of functions: If, then Essentially, we can ignore all but the largest term If 3 9 4, then / 3 9/ 6/. As, those last two terms approach 0. Check out the graph (URL: https://www.desmos.com/calculator/zqqizfs2sh), and try changing the 9 to 900. See the limit for / (click this link, URL: https://www.wolframalpha.com/input/?i=limit%5b(4+%2b+9+n+%2b+3+n%5e2)%2f(n %5E2),+%7Bn+ %3E+Infinity%7D%5D) Also see the limit for / (click this link, URL: https://www.wolframalpha.com/input/?i=limit%5bn%5e2%2f(4+%2b+9+n+%2b+3+n% 5E2),+%7Bn+ %3E+Infinity%7D%5D). Instructions: For this question, fill in the first blank with the ratio of these two functions. Next determine what that implies about bounding and fill in the other blank with one of the five symbols (O, Ω, Θ, o, or ω). 10. If (see this link, URL: https://www.wolframalpha.com/input/?i=sum+i,+i%3d1+to+n), and, then / = _1/2 + 1/(2n)_, which means that = _Θ_ Facts about logarithm bases: Check out these log functions of different bases and their relationships (URL: https://www.desmos.com/calculator/mnykkwcpvt) Instructions: Fill in the first blank with the ratio of these two functions. Next determine what that implies about bounding and fill in the other blank with one of the five symbols (O, Ω, Θ, o, or ω). 11. If and, then / = _3_, which means that = Θ