reopened by
914 views
0 votes
0 votes

An algorithm is made up pf two modules $M1$ and $M2.$ If order of $M1$ is $f(n)$ and $M2$ is $g(n)$ then the order of algorithm is

  1. $max(f(n),g(n))$
  2. $min(f(n),g(n))$
  3. $f(n) + g(n)$
  4. $f(n) \times g(n)$
reopened by

1 Answer

2 votes
2 votes
option A will be correct

In order to find the order of the algorithm, there are three possible cases with f(n) and g(n)
Case-1 : if f(n) > g(n)
In this case we take O(f(n)) the complexity of the algorithm as g(n) is a lower order term, we can ignore this one .
Case-2 : f(n) < g(n)
In this case we take O(g(n)) the complexity of the algorithm as f(n) is a lower order term, we can ignore this one.
Case-3: f(n) = g(n)
Time Complexity can be either O(g(n)) or O(f(n)) (which is equal asymptotically). So the order of the algorithm is max(f(n), g(n))
Answer:

Related questions

0 votes
0 votes
0 answers
1
2 votes
2 votes
2 answers
2
admin asked Apr 1, 2020
843 views
The average search time for hashing with linear probing will be less if the load factorIs far less than oneEquals oneIs far greater than oneNone of the above