A comprehensive collection of algorithms and data structures implemented in JavaScript and Python with detailed explanations, tests, and usage examples.
- Project Overview
- Quick Start
- Project Structure
- Algorithm Categories
- Installation
- Running Tests
- Contributing
- License
This repository contains:
- 32+ JavaScript algorithms with full test coverage
- 500+ Python algorithms including LeetCode solutions
- Detailed complexity analysis (Big O notation)
- Interactive examples and visualizations
- Comparative analysis of different approaches
- Students learning algorithms and data structures
- Developers preparing for technical interviews
- Educators and mentors
- Anyone looking to deepen their Computer Science knowledge
# Clone the repository
git clone https://github.com/your-username/algorithms.git
cd algorithms/javascript
# Install dependencies
npm install
# Run tests
npm test
# Run specific test
npm test anagrams# Navigate to Python directory
cd python
# Install dependencies
pip install -r requirements.txt
# Run tests
pytest
# Run specific file
python BinarySearch.pyalgorithms/
├── javascript/ # JavaScript implementations
│ ├── anagrams/ # Anagram checking
│ ├── sorting/ # Sorting algorithms
│ ├── tree/ # Trees and traversals
│ ├── linkedlist/ # Linked lists
│ └── ... # Other algorithms
├── python/ # Python implementations
│ ├── BinarySearch.py # Binary search
│ ├── Fibonacci.py # Fibonacci numbers
│ ├── sorting/ # Sorting algorithms
│ └── ... # 500+ algorithms
├── docs/ # Documentation
├── tests/ # Additional tests
└── README.md # This file
- Anagrams - Check if two strings are anagrams
- Palindrome - Check if string is palindrome
- Reverse String - Reverse a string
- Capitalize - Capitalize words in string
- Max Character - Find most frequent character
- Fibonacci - Fibonacci numbers (recursion + memoization)
- FizzBuzz - Classic FizzBuzz problem
- Reverse Integer - Reverse digits of integer
- Steps/Pyramid - Print step/pyramid patterns
- Bubble Sort - Bubble sort O(n²)
- Selection Sort - Selection sort O(n²)
- Merge Sort - Merge sort O(n log n)
- Binary Search - Binary search O(log n)
- Linked Lists - Linked list implementations
- Stacks - Stack data structure
- Queues - Queue data structure
- Trees - Tree structures (BFS, DFS)
- Binary Search Trees - BST implementations
- Tree Traversal - Tree traversal algorithms
- Level Width - Calculate tree level widths
- Validate BST - BST validation
- Graph Algorithms - Graph algorithms
- Fibonacci DP - Fibonacci with memoization
- Climbing Stairs - Staircase climbing problem
- Coin Change - Coin change problem
- Longest Subsequence - Longest common subsequence
- Node.js 14+ for JavaScript
- Python 3.7+ for Python
- Git for cloning repository
- Clone Repository
git clone https://github.com/your-username/algorithms.git
cd algorithms- JavaScript Setup
cd javascript
npm install
npm test- Python Setup
cd ../python
pip install -r requirements.txt
pytest# All tests
npm test
# Specific algorithm
npm test anagrams
npm test sorting
npm test tree
# With verbose output
npm test -- --verbose# All tests
pytest
# Specific file
pytest test_binary_search.py
# With coverage
pytest --cov=.const anagrams = require('./anagrams');
const { bubbleSort } = require('./sorting');
// Check anagrams
console.log(anagrams('listen', 'silent')); // true
// Sort array
const arr = [64, 34, 25, 12, 22, 11, 90];
console.log(bubbleSort(arr)); // [11, 12, 22, 25, 34, 64, 90]from BinarySearch import binarySearch
from Fibonacci import fib
# Binary search
arr = [1, 3, 5, 7, 9, 11]
result = binarySearch(arr, 0, len(arr)-1, 7)
print(f"Element found at position: {result}")
# Fibonacci numbers
print(f"10th Fibonacci number: {fib(10)}")We welcome contributions from the community! Please see CONTRIBUTING.md for detailed guidelines.
- 🐛 Found a bug? Create an issue
- 💡 Have an idea? Discuss in Discussions
- 🔧 Want to add algorithm? Create a Pull Request
- 📖 Improve documentation? Always welcome!
# Fork the repository
git clone https://github.com/your-username/algorithms.git
cd algorithms
# Create new branch
git checkout -b feature/new-algorithm
# Make changes and add tests
# ...
# Commit changes
git commit -m "Add: new sorting algorithm"
# Push changes
git push origin feature/new-algorithm
# Create Pull Request- JavaScript: 32 algorithms with tests
- Python: 500+ algorithms and solutions
- Test Coverage: 95%+
- Supported Languages: JavaScript, Python
- Planned: Go, Rust, Java
- LeetCode - Practice platform
- HackerRank - Coding challenges
- GeeksforGeeks - Algorithms and data structures
- Visualgo - Algorithm visualizations
- Big O Cheat Sheet - Complexity reference
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to all contributors for their contributions
- Inspiration from the algorithms community
- Special thanks to Computer Science educators
⭐ If this project was helpful, please give it a star!
Created with ❤️ for the developer community