A comprehensive collection of algorithms, data structures, and coding challenges implemented in TypeScript
Features β’ Quick Start β’ Documentation
Click to expand
This repository is a comprehensive collection of TypeScript algorithms and data structures designed for educational purposes. It serves as a reference for developers who want to learn, practice, and master TypeScript while understanding fundamental computer science concepts.
π‘ Note: This repository includes code and patterns from the JavaScript Algorithms repository, translated and enhanced from JavaScript to TypeScript.
- π Well-documented code with TypeScript types
- β Fully tested with Jest test suites
- π Educational focus with clear implementations
- π¨ Clean code following best practices
- π Production-ready implementations
- π Regularly updated with new algorithms and patterns
| Data Structure | Description | Implementation |
|---|---|---|
| HashTable | Key-value mapping with hash function | View Code |
| MinHeap | Binary heap with minimum root | View Code |
| MaxHeap | Binary heap with maximum root | View Code |
| LinkedList | Linear collection of nodes | View Code |
| Queue | FIFO (First In First Out) structure | View Code |
| Stack | LIFO (Last In First Out) structure | View Code |
| MaxPriorityQueue | Priority queue with max priority | View Code |
| MinPriorityQueue | Priority queue with min priority | View Code |
| Trie | Prefix tree for string operations | View Code |
| BinaryTree | Hierarchical tree structure | View Code |
| Algorithm | Category | Description | Implementation |
|---|---|---|---|
| Binary Search | Search | Efficient search in sorted arrays | View Code |
| Linear Search | Search | Simple sequential search | View Code |
| Quick Sort | Sort | Divide and conquer sorting algorithm | View Code |
| Bubble Sort | Sort | Simple comparison-based sort | View Code |
| Bubble Sort Simple | Sort | Simplified bubble sort implementation | View Code |
| Challenge | Category | Description | Implementation |
|---|---|---|---|
| Pair Sum Sorted | Two Pointers | Find pairs in sorted array that sum to target | View Code |
- Comparator - Comparison functions for sorting and searching
- Range - Utility for generating number ranges
- Type Definitions - Common TypeScript type definitions
- Node.js (v16 or higher)
- pnpm (or npm/yarn)
-
Clone the repository
git clone https://github.com/behzadam/algorithms.git cd algorithms -
Install dependencies
pnpm install
-
Run tests
pnpm test
Test Commands
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coverageCode Quality Commands
# Check code formatting
pnpm format:check
# Fix code formatting
pnpm format:fix
# Run ESLint
pnpm lint
# Fix ESLint issues
pnpm lint:fixalgorithms/
βββ src/
β βββ algorithms/ # Algorithm implementations
β β βββ search/ # Search algorithms
β β βββ sort/ # Sorting algorithms
β βββ code-challanges/ # Coding challenges
β βββ data-structure/ # Data structure implementations
β βββ types/ # TypeScript type definitions
β βββ utils/ # Utility functions
βββ jest.config.js # Jest configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Project dependencies
This project is licensed under the MIT License - see the LICENSE file for details.
Have questions or suggestions? Feel free to reach out!
- Email: behzad.am@gmail.com
- GitHub: @behzadam
β Star this repo if you find it helpful!
Made with β€οΈ by behzadam