Understanding Big-O Notation
Next, let's learn about Big-O Notation. Learning about this notation is crucial since it is used to describe the performance/complexity of an algorithm. This notation can be used to establish the relationship between the input to the algorithm and the steps required to execute the algorithm. Notation: O (relationship between the input and steps taken by the algorithm – denoted by "n").
For example: If there is a linear relationship between the input and the steps taken by the algorithm, then the Big-O notation will be O(n). Similarly, for a constant relationship, the notation will be O(constant).
The most frequently used Big-O notations are as follows:
We will now look into some of the complexities noted in the preceding table:
- Constant complexity O(constant):
The complexity of an algorithm is said to be constant if the steps...