Prerequisites
Before you begin, ensure you have the following installed on your system:- Node.js (version 14 or higher)
- npm (comes with Node.js)
- Git (for cloning the repository)
Clone the Repository
Fork the repository
Visit the GitHub repository and click the Fork button in the top-right corner to create your own copy.
Clone your fork
Clone the repository to your local machine:Replace
YOUR_USERNAME with your GitHub username.Install Dependencies
Install the required npm packages:package.json, including:
- TypeScript - For type-safe code compilation
- Jest - Testing framework
- @swc/jest - Fast TypeScript/JavaScript transpiler
- jest-extended - Additional Jest matchers
Verify Installation
To verify that everything is set up correctly, compile the TypeScript code and run the test suite:The first test run may take a few moments as TypeScript compiles all the source files.
Project Structure
Once installed, your project directory will have the following structure:TypeScript Configuration
The project uses TypeScript with strict type checking enabled. You can find the TypeScript configuration intsconfig.json.
To compile TypeScript files manually:
.ts files according to the configuration and output JavaScript files.
Development Workflow
Now that you have the project set up, you can:- Explore the code - Browse through the
algorithms/anddata-structures/directories - Run tests - Execute
npm testto run all tests or target specific tests (see Running Tests) - Make changes - Modify existing implementations or add new ones
- Verify changes - Run tests to ensure your changes work correctly
Next: Running Tests
Learn how to run tests and target specific data structures or algorithms
Troubleshooting
TypeScript Compilation Errors
If you encounter TypeScript compilation errors, ensure you’re using a compatible version:Test Failures
If tests fail unexpectedly:- Ensure all dependencies are installed:
npm install - Clear Jest cache:
npx jest --clearCache - Re-run the tests:
npm test
Node Version Issues
If you encounter compatibility issues, check your Node.js version:Next Steps
Running Tests
Learn how to run and target specific tests
Data Structures
Explore the implemented data structures