Skip to content

behzadam/algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

github-cover-tech-1764013466854

πŸš€ TypeScript Algorithms and Data Structures

A comprehensive collection of algorithms, data structures, and coding challenges implemented in TypeScript

GitHub top language Codacy Badge Lines of code License: MIT

Features β€’ Quick Start β€’ Documentation


πŸ“‹ Table of Contents

Click to expand

🎯 Introduction

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.


✨ Features

  • πŸ” 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

πŸ“š Documentation

πŸ“¦ Data Structures

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

πŸ” Algorithms

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

πŸ’» Coding Challenges

Challenge Category Description Implementation
Pair Sum Sorted Two Pointers Find pairs in sorted array that sum to target View Code

πŸ› οΈ Utilities

  • Comparator - Comparison functions for sorting and searching
  • Range - Utility for generating number ranges
  • Type Definitions - Common TypeScript type definitions

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • pnpm (or npm/yarn)

Installation

  1. Clone the repository

    git clone https://github.com/behzadam/algorithms.git
    cd algorithms
  2. Install dependencies

    pnpm install
  3. Run tests

    pnpm test

πŸ’» Development

Available Scripts

Test Commands
# Run all tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Run tests with coverage
pnpm test:coverage
Code Quality Commands
# Check code formatting
pnpm format:check

# Fix code formatting
pnpm format:fix

# Run ESLint
pnpm lint

# Fix ESLint issues
pnpm lint:fix

Project Structure

algorithms/
β”œβ”€β”€ 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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ“§ Contact

Have questions or suggestions? Feel free to reach out!


⭐ Star this repo if you find it helpful!

Made with ❀️ by behzadam

Releases

No releases published

Packages

 
 
 

Contributors