Big-Oh Basics 1

What is the best asymptotic runtime for the following function?

1
2
function f(x)
     return x * x

O ( x 3 ) O(x^3) O ( x ) O(x) O ( x 2 ) O(x^2) O ( 1 ) O(1)

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Spencer Whitehead
Feb 26, 2016

No matter how big x x gets, it will always go through the same number of operations, simply multiplying the two numbers. Therefore, the function takes constant time.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...