big o - Big O notation for a function with x=>0 -


how should represent function f(x)=2x+1 x->0 big o notation?

with reasons please.

(i think should written o(x) function seems grow faster constant function while 1 of classmate think should written o(1).)

big-o notation, in nutshell, tells performance of algorithm relative size of input. i.e. can use express "on small input, algorithm fast, double input size algorithm becomes 4 times slower...".

your algorithm's performance constant. doesn't iterate or multiples increased size of input. beyond implementation minutiae optimisation, return result in same amount of time.

so it's o(1).

you cannot express value of result using big-o.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -