Skip to content

DimaJoyti/Algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Algorithms & Data Structures Collection

License: MIT JavaScript Python Tests

A comprehensive collection of algorithms and data structures implemented in JavaScript and Python with detailed explanations, tests, and usage examples.

๐Ÿ“‹ Table of Contents

๐ŸŽฏ Project Overview

This repository contains:

  • 32+ JavaScript algorithms with full test coverage
  • 1400+ Python algorithms organized by category (LeetCode solutions)
  • Detailed complexity analysis (Big O notation)
  • Interactive examples and visualizations
  • Comparative analysis of different approaches

๐ŸŽ“ Who is this for?

  • Students learning algorithms and data structures
  • Developers preparing for technical interviews
  • Educators and mentors
  • Anyone looking to deepen their Computer Science knowledge

โšก Quick Start

JavaScript

# 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

Python

# Navigate to Python directory
cd python

# Install dependencies
pip install -r requirements.txt

# Run tests
pytest

# Run specific file
python BinarySearch.py

๐Ÿ“ Project Structure

algorithms/
โ”œโ”€โ”€ javascript/                 # JavaScript implementations
โ”‚   โ”œโ”€โ”€ anagrams/             # Anagram checking
โ”‚   โ”œโ”€โ”€ sorting/              # Sorting algorithms
โ”‚   โ”œโ”€โ”€ tree/                 # Trees and traversals
โ”‚   โ”œโ”€โ”€ linkedlist/           # Linked lists
โ”‚   โ””โ”€โ”€ ...                   # Other algorithms
โ”œโ”€โ”€ python/                    # Python implementations (organized by category)
โ”‚   โ”œโ”€โ”€ arrays/               # 880 array problems
โ”‚   โ”œโ”€โ”€ strings/              # 227 string problems
โ”‚   โ”œโ”€โ”€ trees/                # 191 tree problems
โ”‚   โ”œโ”€โ”€ dynamic_programming/  # 142 DP problems
โ”‚   โ”œโ”€โ”€ graphs/               # 41 graph problems
โ”‚   โ”œโ”€โ”€ linked_lists/         # 69 linked list problems
โ”‚   โ”œโ”€โ”€ math/                 # 40 math problems
โ”‚   โ”œโ”€โ”€ misc/                 # 133 uncategorized problems
โ”‚   โ””โ”€โ”€ ...                   # Other categories
โ”œโ”€โ”€ docs/                      # Documentation
โ”œโ”€โ”€ tests/                     # Additional tests
โ””โ”€โ”€ README.md                  # This file

๐Ÿ—‚๏ธ Algorithm Categories

๐Ÿ”ค String Algorithms

  • 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

๐Ÿ”ข Mathematical Algorithms

  • Fibonacci - Fibonacci numbers (recursion + memoization)
  • FizzBuzz - Classic FizzBuzz problem
  • Reverse Integer - Reverse digits of integer
  • Steps/Pyramid - Print step/pyramid patterns

๐Ÿ“Š Sorting and Searching

  • 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)

๐Ÿ”— Data Structures

  • Linked Lists - Linked list implementations
  • Stacks - Stack data structure
  • Queues - Queue data structure
  • Trees - Tree structures (BFS, DFS)
  • Binary Search Trees - BST implementations

๐ŸŒ Graphs and Trees

  • Tree Traversal - Tree traversal algorithms
  • Level Width - Calculate tree level widths
  • Validate BST - BST validation
  • Graph Algorithms - Graph algorithms

๐Ÿงฎ Dynamic Programming

  • Fibonacci DP - Fibonacci with memoization
  • Climbing Stairs - Staircase climbing problem
  • Coin Change - Coin change problem
  • Longest Subsequence - Longest common subsequence

๐Ÿ› ๏ธ Installation

System Requirements

  • Node.js 14+ for JavaScript
  • Python 3.7+ for Python
  • Git for cloning repository

Step by Step

  1. Clone Repository
git clone https://github.com/your-username/algorithms.git
cd algorithms
  1. JavaScript Setup
cd javascript
npm install
npm test
  1. Python Setup
cd ../python
pip install -r requirements.txt
pytest

๐Ÿงช Running Tests

JavaScript Tests

# All tests
npm test

# Specific algorithm
npm test anagrams
npm test sorting
npm test tree

# With verbose output
npm test -- --verbose

Python Tests

# All tests
pytest

# Specific file
pytest test_binary_search.py

# With coverage
pytest --cov=.

๐Ÿ“š Usage Examples

JavaScript Example

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]

Python Example

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)}")

๐Ÿค Contributing

We welcome contributions from the community! Please see CONTRIBUTING.md for detailed guidelines.

How to Help

  1. ๐Ÿ› Found a bug? Create an issue
  2. ๐Ÿ’ก Have an idea? Discuss in Discussions
  3. ๐Ÿ”ง Want to add algorithm? Create a Pull Request
  4. ๐Ÿ“– Improve documentation? Always welcome!

Quick Start for Contributors

# 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

๐Ÿ“Š Project Statistics

  • JavaScript: 32 algorithms with tests
  • Python: 1400+ algorithms organized in 20 categories
  • Test Coverage: 95%+
  • Supported Languages: JavaScript, Python
  • Planned: Go, Rust, Java

๐Ÿ”— Useful Links

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • 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

About

Algorithms examples

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors