Problem in time complexity analysis

i want to ask a question— if my program passes 10^6 instrction in 1 second than how much instructions it will pass in 2 seconds??
i am confused between answers as 210^6 instructions and 10^12 instructions… please clear my doubts*

2 x 10^6 instructions dear.

Thats why if your program didnt do it in 1 sec, it needs some 10^x amount of time (exponential time) (talking about nested loops etc.)

1 Like

@vijju123
Yes u are somewhat right…online judges can handle 10^9 instructions a second

1 Like

It would take 2x10^6 because for each second it get added so for 1 sec 10^6 and for other 10^6 ,we will add them since number of operations are addition of these two. So the answer is 2x10^6.

got ur point

Usually online judges can do ~10^8 instructions a second. Use this while reading the Q t analyse if your intended algo would work or not. (Cant remember exact value, like if it was 5.2x 10^8 or 7x 10^8, but yeah, you got the point).

Ya, the value is somewhere around that range. Thanks for confirmation!

There, fixed the format. :slight_smile: