show the following is a O(n^2) by supplying answers to the three steps below.
f(n)=9n^2+4
1 setup the problem
2 isolate constant c
3 determine values for k and c that make this inequality
bold
Question:
Show the following is a O(n2) by supplying answers to the three steps below.
f(n)=9n2+4
1 setup the problem
2 isolate constant c
3 determine values for k and c that make this inequality
bold
Answer:
Let f and g be functions from positive numbers to positive numbers. f(n) is O(g(n)) if there are positive constants C and k such that:
f(n) ≤ C.g(n) whenever n > k
Taking value of k = 1.
Assuming n >1,
Choose C = 13
Thus, 9n2+4 is O(n2) because 9n2+4 < 13n2 whenever n>1.
Consequently, we can take C = 13 and k = 1 as witnesses to show that f (n) is O(n2).
Get Answers For Free
Most questions answered within 1 hours.