Answer:
Big O notation is used to describe the performance or complexity of an algorithm. Here are four rules to keep in mind when working with Big O notation:
Coefficients do not matter: When analyzing the performance of an algorithm, the coefficients of the terms in the Big O expression are not important. For example, O(2n) and O(n) are equivalent.
Ignore lower order terms: When analyzing the performance of an algorithm, only the highest order term is important. For example, O(n^2 + n) is equivalent to O(n^2).
Different inputs, different variables: When analyzing the performance of an algorithm with multiple inputs, use different variables to represent the size of each input. For example, if an algorithm takes two arrays as input, use n to represent the size of the first array and m to represent the size of the second array.
Worst case analysis: When analyzing the performance of an algorithm, consider the worst case scenario. For example, if an algorithm takes longer to run when the input is sorted in reverse order, use that scenario when calculating its Big O notation.
Explanation: