diff --git a/README.md b/README.md index 8132b18..edd4cc6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # JavaScript Algorithms And Data Structures +## JavaScript based examples of many algorithms and data structures. +☝ Note that this repository is meant to be used for learning and researching purposes only. + What you will learn in here. Technical: diff --git a/section-big-o/o-n-001.js b/section-big-o/o-n-001.js new file mode 100644 index 0000000..ba91b97 --- /dev/null +++ b/section-big-o/o-n-001.js @@ -0,0 +1,16 @@ +const fish = ['dory', 'bruce', 'marlin', 'O_n-001']; +const single = ['O_n-001']; +const everyone = ['dory', 'bruce', 'marlin', 'O_n-001', 'gill', 'bloat', 'nigel', 'squirt', 'darla', 'hank']; +const large = new Array(100000).fill('O_n-001'); + + +function findSpecificNameFromArray(array) { + for (let index = 0; index < array.length; index++) { + const element = array[index]; + if (element === 'O_n-001') { + console.log('Found O_n-001'); + } + } +} + +findSpecificNameFromArray(single); // O(n) ----> Linear Time \ No newline at end of file diff --git a/section-big-o/sample-002.js b/section-big-o/sample-002.js deleted file mode 100644 index 94037a3..0000000 --- a/section-big-o/sample-002.js +++ /dev/null @@ -1 +0,0 @@ -// Hello world \ No newline at end of file