Two of the biggest considerations when writing any code are memory usage and time complexity (speed). Big-O notation offers a framework to quantifying the relative memory and speed performance of the algorithm in terms of the size of the input \(n\). When comparing the performance of algorithms we want to remove the variability of the machines performance, and focus on the factors which influence an algorithms performance from a coding perspective.
Example Problem: Sudoku
The memory and time complexity of different algorithms change significantly depending on the problem being solved. Take a Sodoku puzzle for example, where \(n\) represent the width and height of the grid. Sodoku puzzles are considered to be very difficult problems when the size of the puzzle becomes larger. This is because there are more combinations to test in order to find the correct solution. This is also true for an algorithm, and therefore we can write the time complexity to solve a Sodoku puzzle in terms of the size of the grid \(n\).