This is a pretty bare-bones repository containing common algorithms implemented using TypeScript and bun
for compilation and testing.
The folder structure is as follows:
.gitignore
bun.lockb <-- bun lock file
package.json
src/
/dynamicProgramming/ <-- directory containing dynamic programming problems/solutions/tests
[problemName].ts
[problemName].test.ts
/leetCode/ <-- directory containing leetcode problems/solutions/tests
[problemName].ts
[problemName].test.ts
/pathfinding/
[algorithmName].ts
[algorithmName].test.ts
[algorithmName]/
[algorithmName].ts <-- sorting function
[algorithmName].test.ts <-- test for the algorithm
Every algorithm is accompanied with js doc comments that explain:
- What the algorithm is doing
- It's time complexity (in Big O notation)
- Searching
- Binary Search
- Pathfinding (located in
src/pathfinding/<algorithmName>/
)- Dijkstra
- Sorting (located in
src/sortingAlgorithms/<algorithmName>/
)- Bubble Sort
- Selection Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Radix Sort (LSD)
- leetCode (directory containing leetcode problems/solutions with tests)
- addTwoNumbers
- maxSubsequence
- longestSubstring
- longestCommonPrefix
- twoSum
- medianOfTwoArrays
Important: This project is setup to use bun
which is currently only supported on macOS, Linux and WSL. So in order to run this project on a windows machine, you must be in WSL.
- Installing Bun: Run
curl -fsSL https://bun.sh/install | bash
from the command line. - Run
bun install
to add the packages tonode_modules
- Run
bun test
to run the tests
Since there is no UI, the only available command is npm run test
.
If you would like a code coverage report, run:
bun coverage