Skip to content

H0NEYP0T-466/DSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ DSA: Master Data Structures & Algorithms ๐Ÿš€

License Stars Forks Issues Contributions Welcome

Welcome to DSA! ๐ŸŽ‰ This repository is your go-to resource for learning and mastering Data Structures and Algorithms (DSA) through clean, well-documented C++ implementations. It includes core DSA concepts and solutions to popular LeetCode-style problems, making it perfect for students, coding enthusiasts, and anyone preparing for technical interviews. Whether you're a beginner or sharpening your skills, this repo has something for you! ๐Ÿ’ป

๐Ÿ“‘ Table of Contents

โœจ Features

  • Comprehensive DSA Implementations: Covers essential data structures and algorithms with clear, optimized C++ code. ๐Ÿง 
  • LeetCode-Style Problems: Solutions to common algorithmic problems to boost your problem-solving skills. ๐ŸŽฏ
  • Well-Organized Files: Each .cpp file is named after the specific data structure or algorithm it implements. ๐Ÿ“‚
  • Beginner-Friendly: Easy-to-understand code with comments for learning and reference. ๐Ÿ“š
  • Ready-to-Run: Simple compilation instructions to get you started quickly. โšก

๐Ÿ“‚ File Structure

The repository is organized such that each .cpp file contains a specific data structure implementation or algorithm solution. Filenames are descriptive, matching the topic or problem (e.g., bfs_traversal.cpp, two_sum.cpp). All files are located in the root directory for simplicity.

DSA/
โ”œโ”€โ”€ adjacency_list.cpp                    # Graph representation using adjacency list
โ”œโ”€โ”€ adjacency_matrix.cpp                  # Graph representation using adjacency matrix
โ”œโ”€โ”€ arrays.cpp                                      # Array-based operations
โ”œโ”€โ”€ asd.cpp                                         # Additional data structure implementations
โ”œโ”€โ”€ avl _trees_rotations.cpp                        # AVL tree with rotations
โ”œโ”€โ”€ avl_trees.cpp                                   # AVL tree implementation
โ”œโ”€โ”€ bellman_ford_algo.cpp                 # Bellman-Ford shortest path algorithm
โ”œโ”€โ”€ bfs_traversal.cpp                     # Breadth-First Search for graphs
โ”œโ”€โ”€ binary_search_trees.cpp               # Binary Search Tree operations
โ”œโ”€โ”€ binary_tree.cpp                                 # Binary Tree implementation
โ”œโ”€โ”€ bs.cpp                                          # Binary search algorithm
โ”œโ”€โ”€ bucket_array.cpp                                # Hash table with bucket arrays
โ”œโ”€โ”€ circular_linked_lists.cpp             # Circular linked list operations
โ”œโ”€โ”€ cycle_linkedlist.cpp                  # Detect cycle in linked list
โ”œโ”€โ”€ dfs_traversal.cpp                     # Depth-First Search for graphs
โ”œโ”€โ”€ dijkstars_algo.cpp                    # Dijkstraโ€™s shortest path algorithm
โ”œโ”€โ”€ doubly_circular_linked_lists.cpp      # Doubly circular linked list
โ”œโ”€โ”€ doubly_linked_lists.cpp                         # Doubly linked list operations
โ”œโ”€โ”€ dsa_final.cpp                                   # Comprehensive DSA implementation
โ”œโ”€โ”€ final.cpp                                       # Final implementation file
โ”œโ”€โ”€ hash_map.cpp                                    # Hash map implementation
โ”œโ”€โ”€ heaps.cpp                             # Heap data structure and operations
โ”œโ”€โ”€ largest_rectangle_histrogram,next_smallest_largest_element.cpp  # Histogram problems
โ”œโ”€โ”€ longest_substring_without_repeating.cpp # Longest substring without repeating chars
โ”œโ”€โ”€ next&prev_smallest element.cpp                  # Next/previous smaller element
โ”œโ”€โ”€ pattern.cpp                           # Pattern matching algorithm
โ”œโ”€โ”€ prims_algo.cpp                        # Primโ€™s minimum spanning tree algorithm
โ”œโ”€โ”€ product_ofarray_exceptself.cpp        # Product of array except self
โ”œโ”€โ”€ queues.cpp                            # Queue implementation
โ”œโ”€โ”€ queues_using_stacks.cpp               # Queue using stacks
โ”œโ”€โ”€ reverse_linkedLIst.cpp                # Reverse a linked list
โ”œโ”€โ”€ singly_linked_lists.cpp               # Singly linked list operations
โ”œโ”€โ”€ stack.cpp                             # Stack implementation
โ”œโ”€โ”€ two_sum.cpp                           # Two Sum problem solution
โ”œโ”€โ”€ validat_BST.cpp                       # Validate Binary Search Tree
โ”œโ”€โ”€ valid_parenthesis.cpp                 # Valid parenthesis checker
โ”œโ”€โ”€ vectors.cpp                           # Vector operations in C++
โ””โ”€โ”€ README.md                             # Project documentation

Total Files: 37 C++ implementations + 1 README

๐Ÿ›  Tech Stack

  • C++: Primary language for all implementations (C++11 or later recommended).
  • Compiler: Use g++ or any standard C++ compiler (e.g., GCC, Clang, MSVC).
  • No External Libraries: Pure C++ with standard libraries (<vector>, <queue>, <stack>, etc.).

Compilation Instructions:

  • Ensure you have a C++ compiler installed (e.g., g++ via MinGW, GCC, or Clang).
  • Compile any .cpp file using: g++ filename.cpp -o filename.
  • Run the executable: ./filename (Linux/macOS) or filename.exe (Windows).

๐Ÿš€ Installation

  1. Clone the repository:

    git clone https://github.com/H0NEYP0T-466/DSA.git
  2. Navigate to the project directory:

    cd DSA
  3. Ensure you have a C++ compiler installed:

    • Linux/macOS: Install g++ via package manager
    • Windows: Install MinGW, MSYS2, or Visual Studio
    • Online: Use platforms like Replit, CodeBlocks, or any online C++ compiler
  4. Verify installation:

    g++ --version

๐Ÿš€ Usage

  1. Compile a specific file (e.g., bfs_traversal.cpp):

    g++ bfs_traversal.cpp -o bfs_traversal
  2. Run the program:

    ./bfs_traversal      # Linux/macOS
    bfs_traversal.exe    # Windows
  3. Example workflow:

    # Compile and run queue implementation
    g++ queues.cpp -o queues && ./queues
    
    # Compile and run binary search tree
    g++ binary_search_trees.cpp -o bst && ./bst
    
    # Compile and run graph traversal
    g++ dfs_traversal.cpp -o dfs && ./dfs
  4. Explore the code, modify inputs, or use it as a reference for your learning!

๐Ÿ“š Topics Covered

This repository covers a wide range of DSA topics and LeetCode-style problems, including:

  • Arrays:
    • Basic array operations (arrays.cpp)
    • Product of array except self (product_ofarray_exceptself.cpp)
    • Largest rectangle in histogram (largest_rectangle_histrogram,next_smallest_largest_element.cpp)
  • Linked Lists:
    • Singly linked lists (singly_linked_lists.cpp)
    • Doubly linked lists (doubly_linked_lists.cpp)
    • Circular linked lists (circular_linked_lists.cpp)
    • Doubly circular linked lists (doubly_circular_linked_lists.cpp)
    • Cycle detection (cycle_linkedlist.cpp)
    • Reverse linked list (reverse_linkedLIst.cpp)
  • Stacks & Queues:
    • Stack implementation (stack.cpp)
    • Queue implementation (queues.cpp)
    • Queue using stacks (queues_using_stacks.cpp)
    • Valid parenthesis checker (valid_parenthesis.cpp)
  • Trees:
    • Binary Tree (binary_tree.cpp)
    • Binary Search Tree (binary_search_trees.cpp)
    • AVL Trees (avl_trees.cpp, avl _trees_rotations.cpp)
    • Validate BST (validat_BST.cpp)
  • Graphs:
    • Adjacency List (adjacency_list.cpp)
    • Adjacency Matrix (adjacency_matrix.cpp)
    • Breadth-First Search (bfs_traversal.cpp)
    • Depth-First Search (dfs_traversal.cpp)
    • Dijkstraโ€™s Algorithm (dijkstars_algo.cpp)
    • Bellman-Ford Algorithm (bellman_ford_algo.cpp)
    • Primโ€™s Algorithm (prims_algo.cpp)
  • Heaps:
    • Heap implementation (heaps.cpp)
  • Hash Maps:
    • Hash map implementation (hash_map.cpp)
    • Two Sum problem (two_sum.cpp)
  • Miscellaneous:
    • Longest substring without repeating characters (longest_substring_without_repeating.cpp)
    • Next/previous smallest element (next&prev_smallest element.cpp)
    • Pattern matching (pattern.cpp)
    • Vectors (vectors.cpp)

๐Ÿ”ฎ Roadmap

Weโ€™re excited to keep growing this repository! Planned enhancements include:

  • More LeetCode Problems: Add solutions to additional algorithmic challenges. ๐ŸŽฏ
  • Optimizations: Improve time and space complexity for existing solutions. โšก
  • Competitive Programming: Include solutions tailored for platforms like Codeforces and AtCoder. ๐Ÿ†
  • Documentation: Add detailed comments and explanations for complex algorithms. ๐Ÿ“œ
  • Testing Framework: Introduce unit tests for each implementation. ๐Ÿงช

๐Ÿค Contributing

Contributions are welcome! Whether youโ€™re fixing bugs, adding new algorithms, or improving documentation, your help is appreciated. To contribute:

  1. Fork the repository on GitHub.
  2. Clone your fork: git clone https://github.com/your-username/DSA.git.
  3. Create a new branch: git checkout -b feature/your-feature-name.
  4. Add your changes and commit: git commit -m "Add your feature".
  5. Push to your fork: git push origin feature/your-feature-name.
  6. Open a pull request with a clear description of your changes.

๐Ÿ“„ License

This project is licensed under the MIT License:

MIT License

Copyright (c) [YEAR] [AUTHOR_NAME]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

๐Ÿ™ Acknowledgements

  • Open Source Community: For inspiring collaborative learning and development ๐ŸŒ
  • Algorithm Enthusiasts: For sharing knowledge and best practices ๐Ÿ“š
  • Educational Platforms: LeetCode, HackerRank, and others for providing practice problems ๐ŸŽฏ
  • C++ Community: For maintaining excellent documentation and resources ๐Ÿ’ป
  • Contributors: Thank you to everyone who has contributed to this repository! ๐Ÿค

๐ŸŒŸ Start mastering DSA with C++ today! Letโ€™s code, learn, and conquer those algorithms together! ๐Ÿ’ช

About

DSA is a collection of Data Structures & Algorithms in C++ ๐Ÿ–ฅ๏ธ, covering arrays ๐Ÿ“Š, linked lists ๐Ÿ”—, stacks ๐Ÿ“ฆ, queues ๐ŸŽฏ, trees ๐ŸŒณ, graphs ๐ŸŒ, and algorithms like Dijkstraโ€™s ๐Ÿš€, Bellman-Ford ๐Ÿ“ก, and AVL Trees โš–๏ธ, plus selected LeetCode solutions ๐Ÿ’ก for learning and mastering DSA.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages