Skip to content

Commit 9a84da9

Browse files
Merge pull request #23 from wakidurrahman/feat/o-n
add o-n first
2 parents 112714e + b7e919f commit 9a84da9

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# JavaScript Algorithms And Data Structures
2+
## JavaScript based examples of many algorithms and data structures.
3+
☝ Note that this repository is meant to be used for learning and researching purposes only.
4+
25
What you will learn in here.
36

47
Technical:

section-big-o/o-n-001.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const fish = ['dory', 'bruce', 'marlin', 'O_n-001'];
2+
const single = ['O_n-001'];
3+
const everyone = ['dory', 'bruce', 'marlin', 'O_n-001', 'gill', 'bloat', 'nigel', 'squirt', 'darla', 'hank'];
4+
const large = new Array(100000).fill('O_n-001');
5+
6+
7+
function findSpecificNameFromArray(array) {
8+
for (let index = 0; index < array.length; index++) {
9+
const element = array[index];
10+
if (element === 'O_n-001') {
11+
console.log('Found O_n-001');
12+
}
13+
}
14+
}
15+
16+
findSpecificNameFromArray(single); // O(n) ----> Linear Time

section-big-o/sample-002.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)