Question

In: Computer Science

(a) Explain the difference between big-O and big-theta, and give examples of each to show the...

(a) Explain the difference between big-O and big-theta, and give examples of each to show the difference.
(b) How can we say that two functions have the same asymptotic complexity, using big-theta notation?
(c) Rank the following functions in order of increasing complexity (rate of growth), and indicate which functions have the same asymptotic complexity.
x2; x log(x); 2x; log(x) + 7; 92x2 + 57x + 3921; 4x; 27x2 + 8x3; 22x+5; log(x42); 3x + 12.

Solutions

Expert Solution

a)

Big O always give the upper asymptotic bound, whereas big Theta always give the tight bound.

Everything that is Theta(f(n)) is also O(f(n)), but T(n) is said to be Theta(f(n)), if it is both O(f(n)) and Omega(f(n)).

Example, if f(n) = n, then theta(f(n)) = n.

Whereas Big-O of f(n) could be O(n), O(n2), O(n3), etc.

b) Two functions f1(n) and f2(n) have the same complexity if there exists positive constant integers c1, c2, c3, c4 such that for all n >= n0, we have

0 <= c1 * g(n) <= f1(n) <= c2 * g(n)

0 <= c3 * g(n) <= f2(n) <= c4 * g(n)

c)

The rank  in order of increasing complexity (rate of growth) is given as:

log(x) + 7, log(x42), 3x + 12, x log(x), x2; 92x2 + 57x + 3921; 27x2 + 8x3; 2x; 22x+5

log(x) and log(x42) belong to the same asymptotic complexity.

x2 and 92x2 + 57x + 3921 belong to the same asymptotic complexity.

2x and 22x+5 belong to the same asymptotic complexity.


Related Solutions

Explain the difference between natural and artificial immunity, and give examples of each.
Explain the difference between natural and artificial immunity, and give examples of each.
Explain the difference between macroeconomics and microeconomics. Give examples of the areas of concern for each...
Explain the difference between macroeconomics and microeconomics. Give examples of the areas of concern for each branch of economics. How are macro and microeconomics interrelated? 250 words minimum
Explain Delta, Theta and Vega in detail, give examples of each on in real life options...
Explain Delta, Theta and Vega in detail, give examples of each on in real life options contracts of an American based stock(this question requires research). After showing your example explain what the changes in the stock price would do to the greeks in your specific case and why?
Explain Delta, Theta and Vega in detail, give examples of each on in real life options...
Explain Delta, Theta and Vega in detail, give examples of each on in real life options contracts (this question requires research) After showing your example explain what the changes in the stock price would do to the greeks in your specific case and why?
Explain the difference between Microevolution and Macroevolution, and give examples of each. ANSWER IN PARAGRAPH PLEASE
Explain the difference between Microevolution and Macroevolution, and give examples of each. ANSWER IN PARAGRAPH PLEASE
5. Explain the difference between current, fixed and intangible assets. Give two examples of each of...
5. Explain the difference between current, fixed and intangible assets. Give two examples of each of these different types of assets.
Explain the difference between shared and non-shared environments, and give examples (one for each kind of...
Explain the difference between shared and non-shared environments, and give examples (one for each kind of environment) of how they can lead to similarities and differences between a set of siblings.
What is the difference between fiscal and monetary policy? Give examples of each.
What is the difference between fiscal and monetary policy? Give examples of each.
What is the difference between functional and nonfunctional requirements and give examples of each?
What is the difference between functional and nonfunctional requirements and give examples of each?
(1) Explain the difference between debt and equity capital (2) Give 3 examples each of debt...
(1) Explain the difference between debt and equity capital (2) Give 3 examples each of debt security or capital, hybrid security or capital, and equity security or capital. (3) What are the benefits of using debt capital? (4) What are the costs of using debt capital? (5) Identify six theories of capital structure and provide brief explanation
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT