Thess are the solutions to the exercises proposed in the workshop Data Structures and Algorithms in Javascript, which repository can be found here
Note: The main idea is to implement these data structures without using Javascript arrays, but simple objects, which makes the implementation more real (low level like)
- Implement a stack data structure:
- Source: https://github.com/kuychaco/algoClass/blob/master/data-structures/stack.js
- Solution: https://github.com/jscriptcoder/data-structures-algorithms/blob/master/src/data-structures/stack.ts
- Test: TODO
- Create a queue data structure:
- Source: https://github.com/kuychaco/algoClass/blob/master/data-structures/queue.js
- Solution: https://github.com/jscriptcoder/data-structures-algorithms/blob/master/src/data-structures/queue.ts
- Test: TODO
- Start off with some intro to recursion problems
- Source: https://github.com/kuychaco/algoClass/blob/master/recursion/recursionIntro.js
- Solution: https://github.com/jscriptcoder/data-structures-algorithms/blob/master/src/recursion/recursion-intro.ts
- Test: TODO
- If you want a challenge, attempt some popular recursion interview questions:
- Source: https://github.com/kuychaco/algoClass/tree/master/recursion
- Solution:
- Factorial: https://github.com/jscriptcoder/data-structures-algorithms/blob/master/src/recursion/factorial.ts
- Test: TODO
- Fibonacci: https://github.com/jscriptcoder/data-structures-algorithms/blob/master/src/recursion/fibonacci.ts
- Test: TODO
- Flatten: https://github.com/jscriptcoder/data-structures-algorithms/blob/master/src/recursion/flatten.ts
- Test: TODO
- Gratest Common Divisor: https://github.com/jscriptcoder/data-structures-algorithms/blob/master/src/recursion/greatest-common-divisor.ts
- Test: TODO
- Extra: Other data structures (Set, Map)
- Solution:
- Implement the elementary sorting algorithms (bubble, insertion, selection):
- Source: https://github.com/kuychaco/algoClass/tree/master/sorting-algorithms
- Solution:
- Bubble sort: https://github.com/jscriptcoder/data-structures-algorithms/tree/master/src/sorting-algorithms/bubble-sort.ts
- Test: TODO
- Insertion sort: https://github.com/jscriptcoder/data-structures-algorithms/tree/master/src/sorting-algorithms/insertion-sort.ts
- Test: TODO
- Selection sort: https://github.com/jscriptcoder/data-structures-algorithms/tree/master/src/sorting-algorithms/selection-sort.ts
- Test: TODO
- Implement Mergesort
- Implement Quicksort
- [Bonus] Try out Heapsort
- Implement a Linked List:
- Source: https://github.com/kuychaco/algoClass/blob/master/data-structures/linkedList.js
- Solution: https://github.com/jscriptcoder/data-structures-algorithms/blob/master/src/data-structures/linked-list.ts
- Test: TODO
- Create a tree data structure:
- Source: https://github.com/kuychaco/algoClass/blob/master/data-structures/tree.js
- Solution: TODO
- Extra: Implement an ArrayList
- Solution: https://github.com/jscriptcoder/data-structures-algorithms/blob/master/src/data-structures/array-list.ts
- Test: TODO
- Binary Search Tree
- https://github.com/kuychaco/algoClass/blob/master/data-structures/binarySearchTree.js
- TODO: Solution
- Binary Search Array
- https://github.com/kuychaco/algoClass/blob/master/searching-algorithms/binarySearchArray.js
- TODO: Solution
- Binary Search Tree (delete nodes)
- https://github.com/kuychaco/algoClass/blob/master/data-structures/binarySearchTree.js
- TODO: Solution
- Implement a graph
- DFS for graph
- BFS for graph
- [Bonus] BFS/DFS for tree
- Create your own Hash Tables! Watch out for those collisions!