Big-θ (Big-Theta) notation
We'll cover the following...
Let's look at a simple implementation of linear search (in the language of your choice):
var doLinearSearch = function(array, targetValue) {for (var guess = 0; guess < array.length; guess++) {if (array[guess] === targetValue) {return guess; // found it!}}return -1; // didn't find it};
Let's denote the size of the array by array[guess] with targetValue; possibly return the value of guess; and increment guess. Each of these little computations takes a constant amount of time each time it executes. If the for-loop iterates -1 at the end. Let's call the time for this overhead