Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Many students are slightly mystified about what exactly the running time T ( n ) as a function of n means, and that s not

Many students are slightly mystified about what exactly the running time T(n) as a function of n means, and thats not exactly surprising. After all, the running time of a program/algorithm depends on its entire input, not just the size of the input. For some inputs of size n, the algorithm might be fast, and for others, it might be slow. So really, the running time can be written as a function Tinput(I), where I is the input of the algorithm. But we usually want to get an idea of how the running time grows as a function of the inputs size. So we define and mostly focus on T(n)= maxinputs I of size n Tinput(I).(This is the definition of running time as a function of n.) Now, lets explore what this means for running time upper and lower bounds. For both of the following sub-questions, in your answers, you should not be referencing any maximum or similar things. Instead, you will want to use for all and exists clearly, i.e., your text (or formulas if you prefer) should be describing quantifiers, and talking about the running time on inputs. (a) Suppose that you want to show that T(n)= O(f(n)). What do you need to show? (b) Suppose that you want to show that T(n)=\Omega (g(n)). What do you need to show? Both of these parts are not very hard if you are precise in applying the definitions and thinking through them. But its easy to get the second one wrong if you just try to wing it.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started