What is the algorithmic complexity of this algorithm? Please answer with an analysis using big O notation.