Algorithm X requires n2 + 9n + 5 operations, and Algorithm Y requires 5n2 operations. What can you conclude about the time requirements for these algorithms when n is small and when n is large? Which is the faster algorithm in these two cases?
Algorithm X requires n²+9 n+5 operations and algorithm Y requires 5 n² operations.
When n is small, for example with n=10, X requires 10 × 10+9 × 10+5=195 operations and Y requires 5 × 10 × 10=500 operations.
with n=100, X requires 100 × 100+9 × 100+5=10950 operations and
Y requires 5 × 100 × 100=50000 operations.
with n=10⁵, X requires 10⁵ × 10⁵+9 × 10⁵+5=10^{10}+90⁵+5 operations and
Y requires 5 × 10⁵ × 10⁵=5 × 10^{10} operations.
Based on the above data we can understand that algorithm X takes lesser operations than algorithm Y, and so it takes less time compared to Y when n is small and also when n is large. So we can conclude that, algorithm X is the faster algorithm compared to Algorithm Y.