Alternating Characters

  • + 0 comments

    This my friend, is not O(n/2). Think of it this way, you are reading al lthe elements in the data set. That is what determines O(). The style of looping is not really a determining factor.

    Moreover, O(N/2) is simply O(0.5N) and that is ignored. This notation does not care about the constant. So, a complexity of O(N) and O(10^4N) and O(0.0003N) is all the same- O(N).