Big Notation

Run Settings
LanguageJavaScript
Language Version
Run Command
const nemo = ['nemo']; function findNemo(array) { let t0 = performance.now(); for (let i = 0; i < array.length; ++i) { if (array[i] ==='nemo') { console.log('Found NEMO'); } } let t1 = performance.now(); console.log('Call to find Nemo took ' + (t1 - t0) + ' milliseconds'); } findNemo(nemo);
const nemo = ['nemo']; const everyone = ['dory','bruce', 'marlin', 'nemo', 'gill','bloat', 'nigel', 'squirt','darla', 'hank']; const large = new Array(10000).fill(nemo) function findNemo(array) { let t0 = performance.now(); for (let i = 0; i < array.length; ++i) { if (array[i] ==='nemo') { console.log('Found NEMO'); } } let t1 = performance.now(); console.log('Call to find Nemo took ' + (t1 - t0) + ' milliseconds'); } findNemo(large);
const nemo = ['nemo']; const everyone = ['dory','bruce', 'marlin', 'nemo', 'gill','bloat', 'nigel', 'squirt','darla', 'hank']; //Big O Notation function findNemo(array) { let t0 = performance.now(); for (let i = 0; i < array.length; ++i) { if (array[i] ==='nemo') { console.log('Found NEMO'); } } let t1 = performance.now(); } findNemo(large);//0(n) --- Linear Time
// const nemo = ['nemo']; // const everyone = ['dory','bruce', 'marlin', 'nemo', 'gill','bloat', 'nigel', // 'squirt','darla', 'hank']; // //Big O Notation // function findNemo(array) { // let t0 = performance.now(); // for (let i = 0; i < array.length; ++i) { // if (array[i] ==='nemo') { // console.log('Found NEMO'); // } // } // let t1 = performance.now(); // } // findNemo(large); //0(n) --- Linear Time const boxes = [0,1,2,3,4,5]; fucntion logFirstTwoBoxes(boxes)) { console.log(boxes[0]); console.log(boxes[0]); } logFirstBoxes(boxes);
Editor Settings
Theme
Key bindings
Full width
Lines