Consider the following two functions:
$g_1(n) = \begin{cases} n^3 \text{ for } 0 \leq n \leq 10,000 \\ n^2 \text{ for } n \geq 10,000 \end{cases}$
$g_2(n) = \begin{cases} n \text{ for } 0 \leq n \leq 100 \\ n^3 \text{ for } n > 100 \end{cases}$
Which of the following is true?
$g_1(n) \text{ is } O(g_2(n))$
$g_1(n) \text{ is } O(n^3)$
$g_2(n) \text{ is } O(g_1(n))$
$g_2(n) \text{ is } O(n)$
Sir please verify answer given by Avik10
Yes. Both (a) and (b) are correct. $n^{2}$^{ }is $O(n^{3})$.
Thus the right option should be B
Gatecse