recategorized by
734 views
3 votes
3 votes
What will be upper bound for following function?

T(n)=n^2 - n^4

a) O(n^2)

b) O(n^3)

c) O(n^4)

d) None of these

I want to understand how the function looks like if it has recurrance of this form?What is meaning of subtraction here if i talk in terms of programming
recategorized by

1 Answer

1 votes
1 votes

This is pretty interesting  Question :)

Q]  What will be upper bound for following function?

The upper bond of the folowing function will be $O(n^{4})$ I need not explain because you have already seen the reference (https://gateoverflow.in/92780/algorithms-time-complexity) We take modulus of the function and calculate the complexity .

Q] I want to understand how the function looks like if it has recurrance of this form?What is meaning of subtraction here if i talk in terms of programming

Recurrence of the form $T(n)=n^{2} - n^{4} $ has got no meaning in real programming . Perhaps these -ve terms in recurrence relations are introduced just to make confusions . In any standard algorithm or Questions all terms in the recurrence relation denoting a code will always contains positive terms only. There is NO MEANING if subtraction is used in recurrence in terms of programming point of view

edited by

Related questions

0 votes
0 votes
2 answers
1
0 votes
0 votes
1 answer
2
1 votes
1 votes
1 answer
3
♥_Less asked Dec 4, 2017
4,453 views
Worst case time complexity of following code? Please explain in detail.void function(int n) { int count = 0; for (int i=0; i<n; i++) for (int j=i; j< i*i; j++) if (j%i ==...
5 votes
5 votes
2 answers
4
shaurya vardhan asked Nov 2, 2017
1,672 views
Consider the following functionVoid func(int n){Int k=n;Int i=0;for(;i<n;i++){while(k>1){k>>=1;}}What is the worst case time complexity of the function?