Big O Notation
Big O notation is a way to represent how well an algorithm scales as the amount of data involved increases. I will go over some examples of the most common orders and try to explain what each one means:
O(1)
This means that the algorithm will perform the same way no matter how long the data set is. This is usually the case for hash tables. Here is an example of an O(1) algorithm:
1
2
3
4
5
var myArray = [];
function addToArray(num) {
myArray.push(num);
}