- How to find Time complexity.
- It is simple when you using only one loop so your time complexity is O(n).
- When your loop ends in middle so time complexity is O(nlogn).
- When you using only condition and pointer time complexity is O(1).
# | User | Rating |
---|---|---|
1 | tourist | 3750 |
2 | Benq | 3726 |
3 | cnnfls_csy | 3690 |
4 | Radewoosh | 3649 |
5 | jiangly | 3631 |
6 | orzdevinwang | 3558 |
7 | -0.5 | 3545 |
8 | inaFSTream | 3477 |
9 | fantasy | 3468 |
10 | Rebelz | 3415 |
# | User | Contrib. |
---|---|---|
1 | adamant | 178 |
2 | awoo | 167 |
3 | BledDest | 165 |
4 | Um_nik | 164 |
5 | maroonrk | 163 |
6 | SecondThread | 158 |
7 | nor | 156 |
8 | -is-this-fft- | 154 |
9 | kostka | 146 |
10 | TheScrasse | 143 |
- How to find Time complexity.
Name |
---|
Thanks a ton!! When will we get O(n^2)?? /s
When you use loop A and you use another loop B in loop A so your time complexity will be 0(n^2).