{"id":26406215,"url":"https://github.com/mehedi-86/data_structure_and_algorithm","last_synced_at":"2025-03-17T17:18:50.982Z","repository":{"id":282771027,"uuid":"949602454","full_name":"Mehedi-86/Data_Structure_And_Algorithm","owner":"Mehedi-86","description":"A comprehensive collection of Data Structures and Algorithms (DSA) in C++, covering key concepts for competitive programming, interviews, and academic learning with optimized implementations. 🚀","archived":false,"fork":false,"pushed_at":"2025-03-16T20:22:40.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T21:26:36.447Z","etag":null,"topics":["algorithm-analysis","algorithm-design","data-structures-and-algorithms","dsa"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mehedi-86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-16T20:09:25.000Z","updated_at":"2025-03-16T20:24:18.000Z","dependencies_parsed_at":"2025-03-16T21:36:45.255Z","dependency_job_id":null,"html_url":"https://github.com/Mehedi-86/Data_Structure_And_Algorithm","commit_stats":null,"previous_names":["mehedi-86/data_structure_and_algorithm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mehedi-86%2FData_Structure_And_Algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mehedi-86%2FData_Structure_And_Algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mehedi-86%2FData_Structure_And_Algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mehedi-86%2FData_Structure_And_Algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mehedi-86","download_url":"https://codeload.github.com/Mehedi-86/Data_Structure_And_Algorithm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244075643,"owners_count":20393980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm-analysis","algorithm-design","data-structures-and-algorithms","dsa"],"created_at":"2025-03-17T17:18:50.200Z","updated_at":"2025-03-17T17:18:50.968Z","avatar_url":"https://github.com/Mehedi-86.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e📌 Data Structure \u0026 Algorithm Repository\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eA comprehensive collection of fundamental and advanced algorithms implemented in C++.\u003c/b\u003e\n\u003c/p\u003e\n\n\u003ch2\u003e📜 Overview\u003c/h2\u003e\n\u003cp\u003eThis repository contains various Data Structure and Algorithm implementations in C++. It covers different problem-solving paradigms that are essential for competitive programming, coding interviews, and real-world applications. Each algorithm is implemented with an efficient approach and optimized for better performance.\u003c/p\u003e\n\n\u003ch2\u003e📁 Folder Structure\u003c/h2\u003e\n\u003cpre\u003e\nDSA/\n│── ApproximationAlgo.cpp   \u003c!-- Approximation Algorithms --\u003e\n│── Array.cpp               \u003c!-- Array Operations --\u003e\n│── Backtracking.cpp        \u003c!-- Backtracking Techniques --\u003e\n│── BranchAndBound.cpp      \u003c!-- Branch and Bound Algorithms --\u003e\n│── DivideAndConquer.cpp    \u003c!-- Divide and Conquer Approach --\u003e\n│── DynamicProgramming.cpp  \u003c!-- Dynamic Programming --\u003e\n│── Graph.cpp               \u003c!-- Graph Algorithms --\u003e\n│── Graph1.cpp              \u003c!-- Additional Graph Algorithms --\u003e\n│── Greedy.cpp              \u003c!-- Greedy Algorithm Implementations --\u003e\n│── HashingAndHashFunction.cpp \u003c!-- Hashing \u0026 Hash Functions --\u003e\n│── HeapAndPrQueue.cpp      \u003c!-- Heap \u0026 Priority Queue --\u003e\n│── LinkedList.cpp          \u003c!-- Linked List Implementation --\u003e\n│── LinkedList1.cpp         \u003c!-- More Linked List Operations --\u003e\n│── SortingAlgo.cpp         \u003c!-- Sorting Algorithms --\u003e\n│── Tree.cpp                \u003c!-- Tree Data Structure --\u003e\n│── Tree1.cpp               \u003c!-- More Tree Operations --\u003e\n│── XorLinkedList.cpp       \u003c!-- XOR Linked List Implementation --\u003e\n\u003c/pre\u003e\n\n\u003ch2\u003e📜 Implemented Algorithms\u003c/h2\u003e\n\n\u003ch3\u003e1️⃣ Sorting Algorithms\u003c/h3\u003e\n\u003cp\u003eSorting is a fundamental operation in computer science, used to arrange data in a specific order. Efficient sorting algorithms improve the performance of search operations and are widely used in databases, file management, and data processing.\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003cb\u003eBubble Sort:\u003c/b\u003e A simple sorting algorithm with O(n²) time complexity.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eSelection Sort:\u003c/b\u003e Finds the minimum element and swaps it into place.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eInsertion Sort:\u003c/b\u003e Builds the sorted list one element at a time.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eMerge Sort:\u003c/b\u003e A divide-and-conquer sorting technique with O(n log n) complexity.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eQuick Sort:\u003c/b\u003e Uses partitioning for sorting and has O(n log n) average complexity.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eHeap Sort:\u003c/b\u003e Uses a binary heap to sort elements efficiently.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch3\u003e2️⃣ Graph Algorithms\u003c/h3\u003e\n\u003cp\u003eGraph algorithms are used to model relationships between objects. They are crucial in networking, AI, and route planning.\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003cb\u003eBreadth-First Search (BFS):\u003c/b\u003e Explores the shortest path in an unweighted graph.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eDepth-First Search (DFS):\u003c/b\u003e Explores as far as possible along a branch before backtracking.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eDijkstra's Algorithm:\u003c/b\u003e Finds the shortest path from a single source.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eKruskal’s Algorithm:\u003c/b\u003e Finds the Minimum Spanning Tree using a greedy approach.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003ePrim’s Algorithm:\u003c/b\u003e Constructs the Minimum Spanning Tree starting from any node.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eBellman-Ford Algorithm:\u003c/b\u003e Computes shortest paths in graphs with negative weights.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch3\u003e3️⃣ Dynamic Programming\u003c/h3\u003e\n\u003cp\u003eDynamic Programming (DP) is a method for solving complex problems by breaking them down into simpler subproblems and storing their solutions to avoid recomputation.\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003cb\u003eKnapsack Problem:\u003c/b\u003e Maximizes value while staying within weight constraints.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eLongest Common Subsequence (LCS):\u003c/b\u003e Finds the longest sequence that appears in two strings.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eLongest Increasing Subsequence (LIS):\u003c/b\u003e Identifies the longest increasing order of numbers.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eFibonacci using DP:\u003c/b\u003e Computes Fibonacci numbers efficiently.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eMatrix Chain Multiplication:\u003c/b\u003e Determines the optimal way to multiply matrices.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch3\u003e4️⃣ Greedy Algorithms\u003c/h3\u003e\n\u003cp\u003eGreedy algorithms build solutions piece by piece, always choosing the next best option. They are useful when local optimization leads to global optimization.\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003cb\u003eHuffman Coding:\u003c/b\u003e A compression technique used in data encoding.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eActivity Selection:\u003c/b\u003e Selects the maximum number of activities that don’t overlap.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eJob Scheduling:\u003c/b\u003e Schedules jobs based on deadlines and profits.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eFractional Knapsack:\u003c/b\u003e Similar to the Knapsack problem but allows fractional item selection.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch3\u003e5️⃣ Approximation Algorithms\u003c/h3\u003e\n\u003cp\u003eApproximation algorithms provide near-optimal solutions to NP-hard problems where finding an exact solution is computationally expensive.\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003cb\u003eTravelling Salesman Problem (TSP):\u003c/b\u003e Finds an approximate shortest tour using the Minimum Spanning Tree (MST) heuristic.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eVertex Cover Problem:\u003c/b\u003e Approximates the smallest vertex cover using a greedy approach.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eKnapsack Problem:\u003c/b\u003e Uses a greedy fractional approach to approximate the optimal solution.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eScheduling Problems (Makespan Minimization):\u003c/b\u003e Uses the Longest Processing Time (LPT) heuristic for job scheduling.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eMaximum Cut Problem (Max-Cut):\u003c/b\u003e Approximates the maximum cut using randomized partitioning.\u003c/li\u003e\n  \u003cli\u003e\u003cb\u003eGraph Coloring (Chromatic Number Approximation):\u003c/b\u003e Estimates the chromatic number using a greedy coloring approach.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch2\u003e💻 Installation \u0026 Usage\u003c/h2\u003e\n\u003cp\u003eTo compile and run any C++ file, use the following command:\u003c/p\u003e\n\u003cpre\u003e\ng++ filename.cpp -o output\n./output\n\u003c/pre\u003e\n\n\u003ch2\u003e🚀 Contribution\u003c/h2\u003e\n\u003cp\u003eContributions are welcome! If you find any issues or want to add new algorithms, feel free to submit a pull request. Follow these steps:\u003c/p\u003e\n\u003col\u003e\n  \u003cli\u003eFork the repository\u003c/li\u003e\n  \u003cli\u003eClone your fork: \u003ccode\u003egit clone https://github.com/YourUsername/Data_Structure_And_Algorithm.git\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003eCreate a new branch: \u003ccode\u003egit checkout -b feature-name\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003eMake your changes and commit: \u003ccode\u003egit commit -m \"Added new feature\"\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003ePush changes: \u003ccode\u003egit push origin feature-name\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003eSubmit a pull request\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003ch2\u003e📜 License\u003c/h2\u003e\n\u003cp\u003eThis project is licensed under the MIT License.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehedi-86%2Fdata_structure_and_algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmehedi-86%2Fdata_structure_and_algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmehedi-86%2Fdata_structure_and_algorithm/lists"}