What Determines the Asymptotic Time Complexity of T(n)=n^2+3?

  • Thread starter Thread starter gfd43tg
  • Start date Start date
  • Tags Tags
    Complexity Time
Click For Summary

Discussion Overview

The discussion revolves around determining the asymptotic time complexity of the function T(n) = n^2 + 3. Participants explore how to choose appropriate values for constants c and k in the context of Big O notation, considering various candidate functions f(n) for comparison.

Discussion Character

  • Homework-related
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant expresses confusion about how to approach the problem due to a lack of visible choices for f(n).
  • Another participant suggests that common choices for f(n) could include functions like e^n, n^3, or n^2, proposing n^2 as the best option.
  • After a bug is fixed, a participant confirms the available choices for f(n) as n^2, n, n log(n), and n^3, reiterating the selection of n^2 as the closest to n^2 + 3.
  • Participants discuss the selection of k, with one suggesting k = 9 to keep it small, and another expressing uncertainty about how to choose k from the given options.
  • There is a debate about the relationship between the choice of c and k, with one participant noting that selecting c seems to imply a choice for k.
  • Another participant argues that as long as c is greater than 1, there will be a corresponding k, while if c is 1 or less, T(n) will exceed cf(n).
  • One participant reflects on their earlier choices for c and f(n) without knowing the options, questioning their correctness.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best approach to selecting c and k, and there are multiple competing views on how these choices interact. The discussion remains unresolved regarding the optimal values for these constants.

Contextual Notes

Participants note limitations in their ability to choose c and k due to the interdependence of these selections and the lack of clarity in the problem statement.

gfd43tg
Gold Member
Messages
949
Reaction score
48

Homework Statement


In this question you will determine the asymptotic time complexity of an algorithm for which the complexity is ##T(n)=n^{2}+3##.

Find a positive real c and a positive integer ##k##, such that

##T(n) \le cf(n)##

holds for all ## n>k ## if ##f(n) ## is the asymptotic time complexity.

What is the best choice for ##f(n)##?

[ans]

What is a good choice for ##c## such that ##k## is small (i.e. less than 10)?What is ##k##?

Homework Equations


The Attempt at a Solution


I am confused how to approach these problems. Unfortunately the choices for ##f(n)## are not visible, there is a bug in the problem. But I was wondering what I should do in order to do these problems. The notes are not adequate (or available to look at, since that is bugged as well).
 
Physics news on Phys.org
If there was a specific list of ##f(n)##'s that you don't have, then you're left guessing.
Commonly, the ##f(n)## is pretty simple, such as ##f(n) = e^n##, ##n^3##, or ##n^2##.

Among those choices, ##f(n) = n^2## would be best. Then use a c of 1.5 and a k of 3.
 
You mean there is no way to analytically choose it?

The bug has been fixed, so the choices are
##n^2##, ##n##, ##nlog(n)##, and ##n^3##, so I pick ##n^2## since that is the closest to ##n^2 + 3##. Next, for ##k## being small (less than 10), I just do ## k = 9## and all ##n \gt 9##.

The choices for ##c## are 5, 0.5, 2, and 1, so I pick 2 since the inequality ##n^2 + 3 \le 2n^2## will be true for all ##n > 9##.

Next they ask what ##k## is, and the choices are 1, 10, 2, and 5. Well, what the heck do I do for that??
 
Last edited:
Maylis said:
You mean there is no way to analytically choose it?

The bug has been fixed, so the choices are
##n^2##, ##n##, ##nlog(n)##, and ##n^3##, so I pick ##n^2## since that is the closest to ##n^2 + 3##. Next, for ##k## being small (less than 10), I just do ## k = 9## and all ##n \gt 9##.

The choices for ##c## are 5, 0.5, 2, and 1, so I pick 2 since the inequality ##n^2 + 3 \le 2n^2## will be true for all ##n > 9##.

Next they ask what ##k## is, and the choices are 1, 10, 2, and 5. Well, what the heck do I do for that??
Hey, I didn't do too bad at picking an ##f(n)## and ##c## without knowing the choices! Did I?

They want ##T(n)≤cf(n)## for all ##n>k##.
with ##T(n)=n^2+3## and ##cf(n)=2(n^2)##.
So, we have ##n^2+3 <= 2n^2## for all ##n>k##.

Clearly, if ##n=0##, then ##0^2+3 <= 2(0^2)##, so ##3<=0##, which is false. So ##n=0## doesn't work.

Let me know if you can't take it from there - I'll walk you through the rest.
 
The problem I have with this is that when you pick ##c##, it's almost as if you are simultaneously supposing a ##k##. Are you supposed to pick the ##c## without regards to a possible ##k##?
 
Maylis said:
The problem I have with this is that when you pick ##c##, it's almost as if you are simultaneously supposing a ##k##.
What you should notice is that as long as ##c## is greater than 1, there will be a ##k##. If ##c## is one or less, then ##T(N)## will always be greater than ##cf(n)##. So, without a list to choose from, I picked ##c=1.5## which would have required ##n>2 (k=2)##. Notice that in this case, even a ##c## that is slightly above 1, allows k to be fairly small.
Maylis said:
Are you supposed to pick the ##c## without regards to a possible ##k##?
This is pretty much just an academic exercise. For most real applications, it would be good enough to say that it was approximates ##cn^2## without worrying about the exact value of ##c##.
 

Similar threads

Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
3K
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
3
Views
2K