Algorithm Complexity: A simple example

The complexity here is: 3n+2 i.e. O(n)

Ref: https://www2.cs.sfu.ca/CourseCentral/125/johnwill/Packet06.pdf