-1

What would these statements mean if f(n) and g(n) are functions over natural numbers?

  1. g(n) is in Θ(f(n)).

and

  1. An algorithm is in the complexity class Θ(f(n)).
EzLo
  • 13,780
  • 10
  • 33
  • 38
wick123
  • 17
  • 4
  • Take a look at this question: https://stackoverflow.com/questions/471199/what-is-the-difference-between-%CE%98n-and-on – Ivaylo Strandjev Aug 22 '18 at 08:19
  • I'm voting to close this question as off-topic because it is not about practical programming but rather belongs on [Computer Science Stack Exchange](https://cs.stackexchange.com/) once the questioner has added more of his own work and explained just where he is stuck. – Rory Daulton Aug 22 '18 at 09:08

3 Answers3

0
  1. g(n) is bracketed by a.f(n) and b.f(n) (where a<b are two constants) for sufficiently large n.

  2. The running time of the algorithm is of order Θ(f(n)).

0

If g(n) is in Θ(f(n))) then there exist real constants a and b greater than zero and an integer constant n0 greater than zero such that for all n > n0, a * f(n) <= g(n) <= b * f(n). For instance, the function g(n) = (1 + sin(n)) * n^2 is O(n^2) because we can choose a = 1, b = 2 and n0 = 1 and verify the inequalities hold.

If an algorithm is in the complexity class Θ(f(n)), then the relation G which maps inputs of size n to numbers of operations m taken to process that input on some implied computer has the following properties:

  1. Both min({m | G(n, m)}) and max({m | G(n, m)}) are defined.
  2. The function g(n) = min({m | G(n, m)}) is in Θ(f(n)).
  3. The function h(n) = max({m | G(n, m)}) is in Θ(f(n)).
Patrick87
  • 27,682
  • 3
  • 38
  • 73
0

For a formal definition of Big Θ notation have a look at Wikipedia. A more descriptive explanation you can find here.

For an algorithm n is the size of the input data (for example the number of elements in a list/array/…) and you will get an estimate of the „cost“ of your algorithm for increasing n. Cost typically means number of elementary operations (arithmetic operations, comparisons, conditions).

Simple example for an „algorithm“: accessing an arbitrary element in a container of size n:

  • for an array you can access each element directly. So cost is constant, meaning f(n) = 1 in your notation
  • for a linked list you have iterate through the list from begin. So on average you have to pass half of the list: f(n) = n/2 (or equivalently f(n) = n).
pH 74
  • 321
  • 2
  • 8