Big O #4

Run Settings
LanguageJavaScript
Language Version
Run Command
// Rule #4 drop non dominants function printAllNumbersThenAllPairSums(numbers) { console.log('these are the numbers:'); numbers.forEach(function(number) { console.log(number); }); console.log('and these are their sums:'); numbers.forEach(function(firstNumber) { numbers.forEach(function(secondNumber) { console.log(firstNumber + secondNumber); }); }); } printAllNumbersThenAllPairSums([1,2,3,4,5]) // O(n + n^2) = O(n^2) dominant term // O(x^2+3x+100+x/2) = O(x^2) again dominant term
Editor Settings
Theme
Key bindings
Full width
Lines