Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
fe32bd2
Update diagrams.xml
StephenGrider Nov 10, 2017
6a389e5
Update diagrams.xml
StephenGrider Nov 10, 2017
35ac131
bst
StephenGrider Nov 10, 2017
a621483
Update diagrams.xml
StephenGrider Nov 10, 2017
5ba6869
Update diagrams.xml
StephenGrider Nov 10, 2017
a14b1d9
Update diagrams.xml
StephenGrider Nov 10, 2017
cf04144
bst
StephenGrider Nov 10, 2017
ee47464
validate
StephenGrider Nov 10, 2017
01b1caa
validate
StephenGrider Nov 10, 2017
f86fca8
validate
StephenGrider Nov 11, 2017
72eeb9f
Update diagrams.xml
StephenGrider Nov 11, 2017
2353e63
Update diagrams.xml
StephenGrider Nov 11, 2017
7eaed0d
events
StephenGrider Nov 11, 2017
9126229
Update diagrams.xml
StephenGrider Nov 13, 2017
8978c69
Update diagrams.xml
StephenGrider Nov 13, 2017
dced4eb
Update diagrams.xml
StephenGrider Nov 13, 2017
ffb0331
Update diagrams.xml
StephenGrider Nov 13, 2017
6325ced
Update diagrams.xml
StephenGrider Nov 13, 2017
abb5dbf
Update diagrams.xml
StephenGrider Nov 13, 2017
90f3856
Update diagrams.xml
StephenGrider Nov 13, 2017
c1caa41
Update diagrams.xml
StephenGrider Nov 13, 2017
e17a68e
Update diagrams.xml
StephenGrider Nov 13, 2017
39d4d86
Update diagrams.xml
StephenGrider Nov 13, 2017
bb6e2e5
Update diagrams.xml
StephenGrider Nov 13, 2017
1ef9c66
events
StephenGrider Nov 13, 2017
1a349ff
Update diagrams.xml
StephenGrider Nov 13, 2017
cab00ec
bst
StephenGrider Nov 13, 2017
654f854
Added diagrams.xml
StephenGrider Nov 13, 2017
6c9cb78
Update diagrams.xml
StephenGrider Nov 13, 2017
b66d697
bst
StephenGrider Nov 13, 2017
26c70db
sort
StephenGrider Nov 13, 2017
256b794
Update diagrams.xml
StephenGrider Nov 13, 2017
a1d5bb9
Update diagrams.xml
StephenGrider Nov 13, 2017
1d4583e
Update diagrams.xml
StephenGrider Nov 13, 2017
d094a4f
Update diagrams.xml
StephenGrider Nov 14, 2017
a84ba71
Update diagrams.xml
StephenGrider Nov 14, 2017
0a1072f
Update diagrams.xml
StephenGrider Nov 14, 2017
a620cc6
Update diagrams.xml
StephenGrider Nov 14, 2017
36488b3
Update diagrams.xml
StephenGrider Nov 14, 2017
1f0dfd5
completed exercises
StephenGrider Nov 15, 2017
f065645
Merge branch 'master' of github.com:StephenGrider/AlgoCasts
StephenGrider Nov 15, 2017
101dcb6
Create README.md
StephenGrider Nov 15, 2017
408cf18
Update test.js
StephenGrider Nov 28, 2017
46139e9
Update package.json
StephenGrider Aug 1, 2018
3608c82
Create LICENSE
StephenGrider Sep 14, 2018
60587af
Merge pull request #34 from StephenGrider/add-license-1
StephenGrider Sep 14, 2018
8aa9aff
Update test.js
StephenGrider Dec 3, 2018
32b9e8b
Update README.md
StephenGrider Dec 3, 2018
f0cce74
Update test.js
StephenGrider Dec 3, 2018
f053cd1
Update index.js
StephenGrider Dec 12, 2018
46aa050
test
bobbyvidal Jul 1, 2019
bc04bb2
reversed string done
bobbyvidal Jul 1, 2019
32e3233
first done
bobbyvidal Jul 1, 2019
1316fc6
palindromes done
bobbyvidal Jul 1, 2019
2cdc299
palindromes done
bobbyvidal Jul 1, 2019
2062a3d
reverseint done
bobbyvidal Jul 1, 2019
1dd85fd
finished maxChar
bobbyvidal Jul 9, 2019
604ce08
finished fizzybuzzy
bobbyvidal Jul 9, 2019
ded912e
finished chunky
bobbyvidal Jul 9, 2019
9bbc76c
finished anagrams
bobbyvidal Jul 9, 2019
5f93271
finished anagrams again
bobbyvidal Jul 9, 2019
8b8b391
finished capitalize
bobbyvidal Jul 12, 2019
354c856
finished steps
bobbyvidal Jul 12, 2019
2fbc6f2
finished pyramids
bobbyvidal Jul 26, 2019
965208e
finished vowels
bobbyvidal Jul 26, 2019
bb6ab59
finished matrix
bobbyvidal Jul 26, 2019
1830576
finished matrix
bobbyvidal Aug 1, 2019
f5c317c
finished palindromes solution 2
bobbyvidal Aug 1, 2019
f4b9326
Merge pull request #1 from bobbyvidal/doingMatrix
bobbyvidal Aug 1, 2019
40c0190
finished fib
bobbyvidal Aug 8, 2019
db9071a
finished fib for second time
bobbyvidal Aug 8, 2019
4b5f2e4
Merge pull request #2 from bobbyvidal/doingMatrix
bobbyvidal Aug 8, 2019
86c3c83
finished fib with memoization
bobbyvidal Aug 13, 2019
f53002a
Merge pull request #3 from bobbyvidal/doingMatrix
bobbyvidal Aug 13, 2019
e5a2498
finished manually building a queue
bobbyvidal Aug 13, 2019
2d8be49
Merge pull request #4 from bobbyvidal/doingMatrix
bobbyvidal Aug 13, 2019
b06f2c8
finished weave
bobbyvidal Aug 14, 2019
89b9889
Merge pull request #5 from bobbyvidal/doingMatrix
bobbyvidal Aug 14, 2019
cce3437
finished stack
bobbyvidal Aug 28, 2019
8a86b44
Merge pull request #6 from bobbyvidal/doingMatrix
bobbyvidal Aug 28, 2019
89b99b8
finished qfroms
bobbyvidal Aug 28, 2019
00127d0
Merge pull request #7 from bobbyvidal/doingMatrix
bobbyvidal Aug 28, 2019
9e97ea7
commit
bobbyvidal Aug 29, 2019
c733634
doing linked lists
bobbyvidal Sep 1, 2019
e946688
Merge pull request #8 from bobbyvidal/doingMatrix
bobbyvidal Sep 1, 2019
fedc146
doing linked lists constructor
bobbyvidal Sep 1, 2019
9155ac0
Merge pull request #9 from bobbyvidal/doingMatrix
bobbyvidal Sep 1, 2019
768d17e
doing linked lists insertFirst function
bobbyvidal Sep 1, 2019
4efa530
Merge pull request #10 from bobbyvidal/doingMatrix
bobbyvidal Sep 1, 2019
13e0425
added size to linkedlist
bobbyvidal Sep 8, 2019
3fa2b2e
finished getFirst
bobbyvidal Sep 8, 2019
f60d7de
Merge pull request #11 from bobbyvidal/doingMatrix
bobbyvidal Sep 8, 2019
32d5c94
finished getLast method
bobbyvidal Sep 10, 2019
048a6b4
Merge pull request #12 from bobbyvidal/doingMatrix
bobbyvidal Sep 10, 2019
ed0d5e7
finished clear and remove first method
bobbyvidal Sep 10, 2019
c049bb0
Merge pull request #13 from bobbyvidal/doingMatrix
bobbyvidal Sep 10, 2019
b244d46
finished clear and remove first method
bobbyvidal Sep 10, 2019
4d66b72
Merge pull request #14 from bobbyvidal/doingMatrix
bobbyvidal Sep 10, 2019
9ec2d4b
finished insert last with resusing code
bobbyvidal Sep 11, 2019
a5ac7d0
Merge pull request #15 from bobbyvidal/doingMatrix
bobbyvidal Sep 11, 2019
93e5a2e
finished getAt
bobbyvidal Sep 15, 2019
9e952c4
Merge pull request #16 from bobbyvidal/doingMatrix
bobbyvidal Sep 15, 2019
c0c0e6c
adding completed hackerrank question1
bobbyvidal Sep 26, 2019
0972c83
adding completed hackerrank question2
bobbyvidal Sep 26, 2019
e0d2f70
adding completed hackerrank question3
bobbyvidal Sep 26, 2019
c01c8a4
adding completed hackerrank question4
bobbyvidal Sep 26, 2019
6fbb8a5
adding completed hackerrank question5
bobbyvidal Sep 26, 2019
e01074b
Merge pull request #17 from bobbyvidal/doingMatrix
bobbyvidal Sep 26, 2019
87909ce
finished removeAt
bobbyvidal Oct 4, 2019
036f208
Merge pull request #18 from bobbyvidal/doingMatrix
bobbyvidal Oct 4, 2019
9f130ab
finished insertAt
bobbyvidal Oct 4, 2019
5d34c50
Merge pull request #19 from bobbyvidal/doingMatrix
bobbyvidal Oct 4, 2019
71dc4c7
finished forEach
bobbyvidal Oct 4, 2019
d3744c7
Merge pull request #20 from bobbyvidal/doingMatrix
bobbyvidal Oct 4, 2019
ff32b35
finished symbol
bobbyvidal Oct 4, 2019
db94f9c
Merge pull request #21 from bobbyvidal/doingMatrix
bobbyvidal Oct 4, 2019
e473ae1
finished sockMerchant
bobbyvidal Oct 4, 2019
3f814fc
Merge pull request #22 from bobbyvidal/doingMatrix
bobbyvidal Oct 4, 2019
53eade7
finished midpoint
bobbyvidal Oct 13, 2019
b59e99d
Merge pull request #23 from bobbyvidal/doingMatrix
bobbyvidal Oct 13, 2019
0a14597
finished circular
bobbyvidal Oct 13, 2019
b54f92b
Merge pull request #24 from bobbyvidal/doingMatrix
bobbyvidal Oct 13, 2019
b96d5e8
finished bst
bobbyvidal Oct 13, 2019
eed6121
finished events
bobbyvidal Oct 13, 2019
e31bb42
Merge pull request #25 from bobbyvidal/doingMatrix
bobbyvidal Oct 13, 2019
c9d5aef
finished levelwidth
bobbyvidal Oct 13, 2019
47fc924
Merge pull request #26 from bobbyvidal/doingMatrix
bobbyvidal Oct 13, 2019
fd29acd
finished sorting
bobbyvidal Oct 27, 2019
de71499
Merge pull request #27 from bobbyvidal/doingMatrix
bobbyvidal Oct 27, 2019
5da82a1
finished validate
bobbyvidal Oct 27, 2019
3d315ed
Merge pull request #28 from bobbyvidal/doingMatrix
bobbyvidal Oct 27, 2019
d3b4059
finished mexican wave challenge
bobbyvidal Oct 27, 2019
41d8d22
Merge pull request #29 from bobbyvidal/doingMatrix
bobbyvidal Oct 27, 2019
06126e6
disemvowel trolls
bobbyvidal Oct 27, 2019
66ca357
Merge pull request #30 from bobbyvidal/doingMatrix
bobbyvidal Oct 27, 2019
308b18e
finished unique in order
bobbyvidal Oct 27, 2019
a9d564f
Merge pull request #31 from bobbyvidal/doingMatrix
bobbyvidal Oct 27, 2019
9cb1ec9
starting node
bobbyvidal Dec 22, 2019
4ef1e6f
finished node
bobbyvidal Dec 22, 2019
f5a508e
starting tree:
bobbyvidal Dec 22, 2019
36d7997
done
bobbyvidal Dec 22, 2019
0467fa6
finished military_time
bobbyvidal Jan 9, 2020
5663043
Merge pull request #32 from bobbyvidal/doingMatrix
bobbyvidal Jan 9, 2020
b3b0515
finished area and circ of circle
bobbyvidal Jan 9, 2020
ec701cb
Merge pull request #33 from bobbyvidal/doingMatrix
bobbyvidal Jan 9, 2020
574167d
finished join imitator
bobbyvidal Jan 9, 2020
690a53d
Merge pull request #34 from bobbyvidal/doingMatrix
bobbyvidal Jan 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AlgoCasts

Companion repo to a course on Udemy.com
13 changes: 0 additions & 13 deletions clean/anagrams/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions clean/capitalize/index.js

This file was deleted.

13 changes: 0 additions & 13 deletions clean/chunk/index.js

This file was deleted.

13 changes: 0 additions & 13 deletions clean/fib/index.js

This file was deleted.

9 changes: 0 additions & 9 deletions clean/linkedlist/index.js

This file was deleted.

20 changes: 0 additions & 20 deletions clean/matrix/index.js

This file was deleted.

10 changes: 0 additions & 10 deletions clean/maxchar/index.js

This file was deleted.

19 changes: 0 additions & 19 deletions clean/pyramid/index.js

This file was deleted.

19 changes: 0 additions & 19 deletions clean/qfroms/index.js

This file was deleted.

11 changes: 0 additions & 11 deletions clean/reversestring/index.js

This file was deleted.

22 changes: 0 additions & 22 deletions clean/steps/index.js

This file was deleted.

12 changes: 0 additions & 12 deletions clean/vowels/index.js

This file was deleted.

9 changes: 9 additions & 0 deletions completed_exercises/adding_big_sums.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function aVeryBigSum(ar) {
let sum = 0

for (let index of ar) {
sum+=index
}

return sum
}
51 changes: 51 additions & 0 deletions completed_exercises/anagrams/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// --- Directions
// Check to see if two provided strings are anagrams of eachother.
// One string is an anagram of another if it uses the same characters
// in the same quantity. Only consider characters, not spaces
// or punctuation. Consider capital letters to be the same as lower case
// --- Examples
// anagrams('rail safety', 'fairy tales') --> True
// anagrams('RAIL! SAFETY!', 'fairy tales') --> True
// anagrams('Hi there', 'Bye there') --> False

function anagrams(stringA, stringB) {
return cleanString(stringA) === cleanString(stringB);
}

function cleanString(str) {
return str
.replace(/[^\w]/g, '')
.toLowerCase()
.split('')
.sort()
.join('');
}

module.exports = anagrams;

// function anagrams(stringA, stringB) {
// const aCharMap = buildCharMap(stringA);
// const bCharMap = buildCharMap(stringB);
//
// if (Object.keys(aCharMap).length !== Object.keys(bCharMap).length) {
// return false;
// }
//
// for (let char in aCharMap) {
// if (aCharMap[char] !== bCharMap[char]) {
// return false;
// }
// }
//
// return true;
// }
//
// function buildCharMap(str) {
// const charMap = {};
//
// for (let char of str.replace(/[^\w]/g, '').toLowerCase()) {
// charMap[char] = charMap[char] + 1 || 1;
// }
//
// return charMap;
// }
File renamed without changes.
19 changes: 19 additions & 0 deletions completed_exercises/area_circ_circle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function area(r) {

let rSquared = r*r

console.log(Math.PI * rSquared)

}

function circumference(r){

let rTimes2 = r*2

console.log(Math.PI * rTimes2)

}

area(4)

circumference(4)
20 changes: 20 additions & 0 deletions completed_exercises/array_comparisons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function compareTriplets(a, b) {
let aWins = 0
let bWins = 0
let finalArray;


for (let i = 0; i < a.length; i++){
if ( a[i] > b[i]){
aWins++;
}
else if ( a[i] < b[i]){
bWins++;
}
else{
finalArray
}

}
return finalArray = [aWins, bWins]
}
7 changes: 7 additions & 0 deletions completed_exercises/array_sum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function simpleArraySum(ar) {
let sum = 0
for ( let i = 0; i < ar.length; i++){
sum += ar[i]
}
return sum
}
49 changes: 49 additions & 0 deletions completed_exercises/bst/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// --- Directions
// 1) Implement the Node class to create
// a binary search tree. The constructor
// should initialize values 'data', 'left',
// and 'right'.
// 2) Implement the 'insert' method for the
// Node class. Insert should accept an argument
// 'data', then create an insert a new node
// at the appropriate location in the tree.
// 3) Implement the 'contains' method for the Node
// class. Contains should accept a 'data' argument
// and return the Node in the tree with the same value.
// If the value isn't in the tree return null.

class Node {
constructor(data) {
this.data = data;
this.left = null;
this.right = null;
}

insert(data) {
if (data < this.data && this.left) {
this.left.insert(data);
} else if (data < this.data) {
this.left = new Node(data);
} else if (data > this.data && this.right) {
this.right.insert(data);
} else if (data > this.data) {
this.right = new Node(data);
}
}

contains(data) {
if (this.data === data) {
return this;
}

if (this.data < data && this.right) {
return this.right.contains(data);
} else if (this.data > data && this.left) {
return this.left.contains(data);
}

return null;
}
}

module.exports = Node;
41 changes: 41 additions & 0 deletions completed_exercises/bst/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const Node = require('./index');

test('Node is a constructor', () => {
expect(typeof Node.prototype.constructor).toEqual('function');
});

test('Node can insert correctly', () => {
const node = new Node(10);
node.insert(5);
node.insert(15);
node.insert(17);

expect(node.left.data).toEqual(5);
expect(node.right.data).toEqual(15);
expect(node.right.right.data).toEqual(17);
});

test('Contains returns node with the same data', () => {
const node = new Node(10);
node.insert(5);
node.insert(15);
node.insert(20);
node.insert(0);
node.insert(-5);
node.insert(3);

const three = node.left.left.right;
expect(node.contains(3)).toEqual(three);
});

test('Contains returns null if value not found', () => {
const node = new Node(10);
node.insert(5);
node.insert(15);
node.insert(20);
node.insert(0);
node.insert(-5);
node.insert(3);

expect(node.contains(9999)).toEqual(null);
});
Loading