That's true but if you simplify (n/2) so it becomes (n^-2). As power is negative we neglect it. and hence the total complexity becomes O(n). What are your views?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice post! Question though, wouldn't the time complexity be O(n / 2 ) since it only goes through half the length of the array?
That's true but if you simplify (n/2) so it becomes (n^-2). As power is negative we neglect it. and hence the total complexity becomes O(n). What are your views?