Question

In: Computer Science

Does every algorithm have a running-time equation? In other words, are the upper and lower bounds...

Does every algorithm have a running-time equation? In other words, are the upper and lower bounds for the running time (on any specified class of inputs) always the same?

Solutions

Expert Solution

The running time of an algorithm is not only a function only of input size (n) but also a function of the input and various running time measurements that weu can define as functions of n. The running time of an algorithm typically grows with the input size, although it may also vary for different inputs of the same size. Every algorithm should have at least some inputs so, it should have a running-time equation.

  • Lower Bound :
    If f(n) be the running time of an algorithm, then g(n) will be the Lower Bound of that algorithm if there exist two constants K1 and N such that f(n) >= K1*g(n) for n > N. It is shown by the asymptotic notation called Big Omega or only Omega. This is known as the best case of any algorithm.
  • Upper Bound :
    If f(n) be the running time of an algorithm, then g(n) will be the Lower Bound of that algorithm if there exist two constants K2 and N such that f(n) <= K2*g(n) for n > N. Upper bound of an algorithm is shown by the asymptotic notation called  Big-O or only Oh notation. This notation is known as the worst case of an algorithm.

So, both upper bound value and lower bound values are different. Our basic intention is to find an optimal algorithm, where upper bound will be  same as its lower bound .


Related Solutions

I'm needing assistance with calculating the Chi-Squared upper and lower bounds. I'm working on an example...
I'm needing assistance with calculating the Chi-Squared upper and lower bounds. I'm working on an example in which I am trying to find a 95% confidence interval estimate for a population variance and this is what the example states: Find the chi-squared upper and lower bounds, X26, .025 =12.832 (this is the upper bound) and X26, .975 = .0831 (this is the lower bound) with 5 (=6-1) degrees of freedom (because remember, the degrees of freedom is “n-1”). Also, we...
Give asymptotic upper and lower bounds for T(n). Assume that T(n) is constant for n <=...
Give asymptotic upper and lower bounds for T(n). Assume that T(n) is constant for n <= 2. Make your bounds as tight as possible, and justify your answers. T(n) = T(n-2) + n^2
Give upper and lower bounds for T(n) in the following recurrence: T(n) = 3T(n/4) + n
Give upper and lower bounds for T(n) in the following recurrence: T(n) = 3T(n/4) + n
Does every polynomial equation have at least one real root? a. Why must every polynomial equation...
Does every polynomial equation have at least one real root? a. Why must every polynomial equation of degree 3 have at least one real root? b. Provide an example of a polynomial of degree 3 with three real roots. How did you find this? c. Provide an example of a polynomial of degree 3 with only one real root. How did you find this?
Why does money have a time value? In other words, why, conceptually, is a dollar today...
Why does money have a time value? In other words, why, conceptually, is a dollar today worth more than a dollar tomorrow? When we talk about interest rates, this is sometimes referred to as a “hurdle rate” or the “opportunity cost(s)” for the various uses of capital. What exactly is meant by this? Why do interest rates serve as a barometer for the various potential uses of an investor’s capital? Suppose you won a $2 Million (after taxes) jackpot in...
In class, we learned that the running time of Karatsuba’s algorithm can be expressed as the...
In class, we learned that the running time of Karatsuba’s algorithm can be expressed as the recurrence T (n) = 3T (n/2) + n. We then used the substitution method to solve the recurrence. When using the substitution method, it seems difficult to make a guess about the upper bound on the running time. However, if we use the recursion tree method, it would be a lot easier. In this question, you are asked to solve this recurrence using the...
Give pseudocode to implement a phase of Boruvka’s algorithm. Argue that ˙ the running time of...
Give pseudocode to implement a phase of Boruvka’s algorithm. Argue that ˙ the running time of your implementation is O(m)
Is time real? In other words, does time exist in the same sense as (say) matter...
Is time real? In other words, does time exist in the same sense as (say) matter or space? Or is it just a product of human consciousness? Please provide a long answer to the question(s) above, using diagram and formula whenever possible.
Write an algorithm to evaluate an infix expression in Java. Calculate its running time
Write an algorithm to evaluate an infix expression in Java. Calculate its running time
Pseudocode and algorithm of merging k sorted list with running time O(Nlogk).
Pseudocode and algorithm of merging k sorted list with running time O(Nlogk).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT