Technical requirements
In this chapter, we are going to delve into three patterns that are important to how any commercial engine performs. There will be some use of Big O notation, which is simply a low-resolution way of measuring the time efficiency of an algorithm. The lower the resulting number when replacing the n with a large number, such as 1,000, the better the time efficiency. For example, an algorithm that compares each element of an array with every other element of the same array could be described as O(n2). This comes from the idea that the algorithm is a couple of nested for loops that run for the length of the input data. Maybe then we improve efficiency, meaning we don’t need to recheck elements as we go through making the seconds for the loop shorter with each iteration. This would result in O(n log2n). Looking at these values, you can tell that for large numbers, O(n2) is far worse, giving an estimated cost of 1,000,000 executions for an array of size 1,000...