Content-Length: 376677 | pFad | http://github.com/GameOfCode64/DSA-JavaScript/commit/efc4c40bebff5b730680b346f19957889679eb10

46 learn about DSA · GameOfCode64/DSA-JavaScript@efc4c40 · GitHub
Skip to content

Commit efc4c40

Browse files
committed
learn about DSA
1 parent 7b10d64 commit efc4c40

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

day9.js renamed to Array/day9.js

File renamed without changes.

Array/tempCodeRunnerFile.js

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

link-list/day10.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// ! DSA in JavaScript day 10
2+
3+
// Todo: Link List
4+
5+
class Node {
6+
constructor(value) {
7+
this.head = value;
8+
this.next = null;
9+
}
10+
}
11+
12+
class LinkedList {
13+
constructor(value) {
14+
this.head = new Node(value);
15+
this.teal = this.head;
16+
this.length = 1;
17+
}
18+
19+
push(value) {
20+
let newNode = new Node(value);
21+
if (!this.head) {
22+
this.head = newNode;
23+
this.teal = newNode;
24+
}
25+
26+
this.teal.next = newNode;
27+
this.teal = newNode;
28+
this.length++;
29+
}
30+
}
31+
32+
const MyList = new LinkedList(1);
33+
34+
MyList.push(10);
35+
console.log(MyList);

test/two-sum.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// ! Two Sum
2+
3+
function TwoSum(array, sum) {
4+
for (let i = 0; i < array.length; i++) {
5+
for (let j = 1; j < array.length; j++) {
6+
if (array[i] + array[j] === sum) {
7+
return [i, j];
8+
}
9+
}
10+
}
11+
}
12+
13+
console.log(TwoSum([2, 7, 4, 8], 15));

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/GameOfCode64/DSA-JavaScript/commit/efc4c40bebff5b730680b346f19957889679eb10

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy