Skip to content

A comprehensive collection of Data Structures and Algorithms implementations in multiple programming languages. This repository serves as a learning resource and reference for developers preparing for coding interviews, competitive programming, or simply wanting to understand fundamental algorithms.

License

Notifications You must be signed in to change notification settings

infincodes/dsa-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

DSA Snippets 🚀

A comprehensive collection of Data Structures and Algorithms implementations in multiple programming languages. This repository serves as a learning resource and reference for developers preparing for coding interviews, competitive programming, or simply wanting to understand fundamental algorithms.

📁 Repository Structure

dsa-snippets/
├── algorithms/
│   ├── sorting/
│   │   ├── bubble_sort/
│   │   ├── quick_sort/
│   │   ├── merge_sort/
│   │   └── ...
│   ├── searching/
│   │   ├── binary_search/
│   │   ├── linear_search/
│   │   └── ...
│   ├── graph/
│   │   ├── bfs/
│   │   ├── dfs/
│   │   ├── dijkstra/
│   │   └── ...
│   ├── dynamic_programming/
│   │   ├── fibonacci/
│   │   ├── knapsack/
│   │   └── ...
│   └── string/
│       ├── kmp/
│       ├── rabin_karp/
│       └── ...
├── DataStructure/
│   ├── LinkedList/
│   │   ├── DoubleLinkedList.cpp
│   │   └── LinkedListIntro.cpp
│   ├── Stack/
│   │   ├── Stack.cpp
│   │   └── Stack.java
│   ├── Queue/
│   │   ├── Queue.cpp
│   │   └── Queue.java
│   └── Tree/
│       └── TreeIntro.cpp
├── tests/
│   ├── algorithms/
│   └── data_structures/
├── docs/
│   ├── complexity_analysis.md
│   ├── language_guides/
│   └── algorithm_explanations/
├── .github/
│   ├── ISSUE_TEMPLATE/
│   └── workflows/
├── CONTRIBUTING.md
├── CODE_OF_CONDUCT.md
└── LICENSE

🌟 Features

  • Multi-language Support: Implementations in C++, Python, Java, JavaScript, Go, and more
  • Comprehensive Testing: Unit tests for all implementations
  • Detailed Documentation: Time/space complexity analysis and explanations
  • Beginner Friendly: Clear comments and step-by-step explanations
  • Interview Ready: Common coding interview problems and solutions

📊 Data Structures Available

Stack Implementation

  • C++: DataStructure/Stack/Stack.cpp - Complete stack implementation with push, pop, top operations
  • Java: DataStructure/Stack/Stack.java - Stack implementation using ArrayList
  • Features: LIFO (Last In First Out) principle, O(1) operations, comprehensive error handling

Queue Implementation

  • C++: DataStructure/Queue/Queue.cpp - Complete queue implementation with enqueue, dequeue operations
  • Java: DataStructure/Queue/Queue.java - Queue implementation using ArrayList
  • Features: FIFO (First In First Out) principle, front/rear access, comprehensive error handling

🚀 Quick Start

  1. Clone the repository

    git clone https://github.com/yourusername/dsa-snippets.git
    cd dsa-snippets
  2. Browse algorithms by category

    # View sorting algorithms
    ls algorithms/sorting/
    
    # View data structures
    ls data_structures/
  3. Run an algorithm

    # Example: Run Python quick sort
    python algorithms/sorting/quick_sort/quick_sort.py
    
    # Example: Compile and run C++ binary search
    g++ algorithms/searching/binary_search/binary_search.cpp -o binary_search
    ./binary_search

📚 Supported Languages

  • C++ (.cpp)
  • Python (.py)
  • Java (.java)
  • JavaScript (.js)
  • Go (.go)
  • Rust (.rs)
  • C (.c)

🤝 Contributing

We welcome contributions from developers of all skill levels! Here's how you can help:

Ways to Contribute

  1. Add new algorithms - Implement algorithms in different languages
  2. Add data structures - Implement fundamental data structures
  3. Write tests - Add unit tests for existing implementations
  4. Improve documentation - Add explanations, complexity analysis
  5. Fix bugs - Report and fix issues in existing code
  6. Add examples - Provide usage examples and test cases

Getting Started

  1. Check our Issues page for open tasks
  2. Look for issues labeled good first issue or help wanted
  3. Read our Contributing Guidelines
  4. Fork the repository and create a new branch
  5. Make your changes and submit a pull request

📋 Issue Labels

  • algorithm - New algorithm implementation needed
  • data-structure - New data structure implementation needed
  • bug - Something isn't working correctly
  • enhancement - Improvement to existing code
  • documentation - Documentation improvements needed
  • test - Test cases needed
  • good first issue - Good for newcomers
  • help wanted - Extra attention needed

🏆 Contributors

Thanks to all the amazing contributors who have helped build this repository!

📊 Complexity Reference

Algorithm Best Case Average Case Worst Case Space
Bubble Sort O(n) O(n²) O(n²) O(1)
Quick Sort O(n log n) O(n log n) O(n²) O(log n)
Merge Sort O(n log n) O(n log n) O(n log n) O(n)
Binary Search O(1) O(log n) O(log n) O(1)

📄 License

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

🌟 Star History

If you find this repository helpful, please consider giving it a star! ⭐

📞 Contact

  • Create an Issue for bug reports or feature requests
  • Start a Discussion for questions or ideas

Happy Coding! 🎉

About

A comprehensive collection of Data Structures and Algorithms implementations in multiple programming languages. This repository serves as a learning resource and reference for developers preparing for coding interviews, competitive programming, or simply wanting to understand fundamental algorithms.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 11