retagged by
2,242 views
1 votes
1 votes

An algorithm is made up of $2$ modules $M_{1}$ and $M_{2}$ . If time complexity of modules $M_{1}$ and $M_{2}$ are $h(n)$ and $g(n)$ respectively, the time complexity of the algorithm is 

  1. $\min (h(n), g(n))$ 
  2. $\max (h(n), g(n))$ 
  3. $h(n) + g(n)$ 
  4. $h(n) * g(n)$ 
retagged by

2 Answers

1 votes
1 votes

option B

Three cases are possible with h(n) and g(n),

Case (i) : h(n) >> g(n)

In this case we take O(h(n)) the complexity of the algorithm as g(n) is a lower order term, we drop it.

Case (ii) : h(n) << g(n)

In this case we take O(g(n)) the complexity of the algorithm as h(n) is a lower order term, we drop it.

Case (iii) : h(n) == g(n)

Time Complexity can be either O(g(n)) or O(h(n)) (which is equal asymptotically).

Hence, max(h(n), g(n))

Answer:

Related questions

2 votes
2 votes
3 answers
1
0 votes
0 votes
2 answers
3
makhdoom ghaya asked Jul 1, 2016
3,371 views
Match the following $:$$\begin{array} {cIcI} & \textbf{List – I} && \textbf{List – II} \\ \text{a.} & \text{DDL} & \text{i.} & \text{LOCK TABLE} \\ \text{b.} & \tex...
2 votes
2 votes
3 answers
4
makhdoom ghaya asked Jul 1, 2016
19,964 views
Let $R =\{A, B, C, D, E, F\}$ be a relation schema with the following dependencies $C \rightarrow F$, $E \rightarrow A$, $EC \rightarrow D$, $A \rightarrow B$. Which of t...