Complexity of code

Can i know the complexity of any code online or its run time only by its code.

1 Like

As far as I know complexity is dependent on the loop used int the code. So it means the runtime of it.
A code that runs only single loops(no nested loop) that is O(n) in complexity.
A single nested looped code is O(n^2) and like this.
you can calculate complexity of a code by the loops used in it.

2 Likes
//