Algorithms, Java, Development, Coding, Computer Science.
System.out.println(number) zero times. If all numbers were > 5 our algorithm would execute: System.out.println(number) n times. That is the worst-case we are looking for when calculating Big O. We can conclude that this example algorithm has O(n) complexity. Rule 4. Only keep the n of the highest