Home > Net >  Why are time complexity graphs only in 1st quadrant? (n>=0)
Why are time complexity graphs only in 1st quadrant? (n>=0)

Time:09-13

I understand time can not be negative, but the "n" we put inside Big-O notation is input integer, right?

That input integer can be negative, so why don't we take 1st and 2nd quadrants?

CodePudding user response:

Input value is not important here, only amount of elements is significant, and amount cannot be negative.

(in some cases we need to account for number magnitude also)

CodePudding user response:

Big-O is not measured on the value of the input but rather on the size of your input.

In cases where your input is a number, what matters is the number of bits, not value. This is an often misunderstood issue with Big-O.

So you can't have negatives because it's a little hard to send something with negative size to a function.

  • Related