Ashukla011 / ASDE_Algorithm_Test

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Time complexity

The main loop runs 11 times, once for each circle Each condition involves constant time operations , Handling the special cases for enemies at circle 3 and 7 also involves constant time operations, as the are just simple arithmetic and conditional checks; since all operations inside the loops are constant time operation and the loop runs a fixed numner of time the time complexity is

O(1)

if we generalize the problem to have n circles instead of a fixed number of circles, the time complxity world be O(n) where n is the number of circles

About


Languages

Language:JavaScript 100.0%