A comprehensive collection of Design and Analysis of Algorithms implementations in C++. This repository contains efficient implementations of fundamental algorithms across various categories including sorting, dynamic programming, greedy algorithms, graph algorithms, and string matching techniques.
- ๐ฆ Installation
- ๐ Usage
- โจ Features
- ๐ Project Structure
- ๐ ๏ธ Built With
- ๐ค Contributing
- ๐ License
- ๐บ๏ธ Roadmap
- ๐ Acknowledgements
- C++ Compiler (GCC 7.0+ or Clang 6.0+ or MSVC 2017+)
- Standard Template Library (STL) support
- Make (optional, for build automation)
-
Clone the repository
git clone https://github.com/H0NEYP0T-466/DAA.git cd DAA -
Compile any algorithm
# Example: Compile Shell Sort g++ -o shell_sort Shell_sort.cpp # Example: Compile Dynamic Programming algorithms g++ -o knapsack Dynamic_progrmaing/01Knapsack_dp_bottom_up.cpp # Example: Compile Greedy algorithms g++ -o huffman greedy_algorithms/huffman_coding.cpp
-
Run the executable
./shell_sort ./knapsack ./huffman
Each algorithm can be compiled and executed independently:
# Sorting Algorithms
g++ -o bucket_sort Bucket_sort.cpp && ./bucket_sort
g++ -o counting_sort Counting_Sort.cpp && ./counting_sort
g++ -o radix_sort Radix_sort.cpp && ./radix_sort
# Dynamic Programming
g++ -o lcs Dynamic_progrmaing/lcs_dp_bottom_up.cpp && ./lcs
g++ -o mcm Dynamic_progrmaing/mcm_dp_bottom_up.cpp && ./mcm
# Greedy Algorithms
g++ -o kruskal greedy_algorithms/kruskal's_algorithm.cpp && ./kruskal
g++ -o fractional_knapsack greedy_algorithms/fractional_knapsack.cpp && ./fractional_knapsack
# String Matching
g++ -o kmp "string_matching(knutt_morris_pratt(kmp) algo ).cpp" && ./kmp
g++ -o rabin_karp "string_matching(rabin_carp Algorithm).cpp" && ./rabin_karp// Example: Using Shell Sort
#include "Shell_sort.cpp"
int main() {
int arr[] = {64, 34, 25, 12, 22, 11, 90};
int n = sizeof(arr)/sizeof(arr[0]);
shellSort(arr, n);
printArray(arr, n);
return 0;
}- Shell Sort - Improved insertion sort with gap sequence
- Bucket Sort - Distribution-based sorting for uniformly distributed data
- Counting Sort - Linear time sorting for integers within a range
- Radix Sort - Non-comparative sorting algorithm
- 0/1 Knapsack Problem - Multiple implementations (brute force, top-down, bottom-up)
- Longest Common Subsequence (LCS) - String similarity algorithms
- Matrix Chain Multiplication - Optimal parenthesization problem
- Fibonacci Series - Various DP approaches with space optimization
- Huffman Coding - Optimal data compression
- Kruskal's Algorithm - Minimum Spanning Tree with Disjoint Set Union
- Fractional Knapsack - Greedy optimization problem
- Activity Selection - Meeting scheduling problem
- Floyd-Warshall Algorithm - All-pairs shortest path
- Topological Sort - Both DFS and BFS (Kahn's) implementations
- Single Source Shortest Path - Using topological sort in DAG
- Knuth-Morris-Pratt (KMP) - Linear time pattern matching
- Rabin-Karp Algorithm - Rolling hash-based matching
- Naive Approach - Brute force string matching
- Kirchoff's Theorem - Circuit analysis implementation
- Optimized implementations with detailed comments
- Multiple algorithm variants for comparison
- Memory-efficient solutions where applicable
DAA/
โโโ ๐ README.md
โโโ ๐ LICENSE
โโโ ๐ CONTRIBUTING.md
โโโ ๐ง .git/
โโโ
โโโ ๐ Sorting Algorithms
โ โโโ Shell_sort.cpp
โ โโโ Bucket_sort.cpp
โ โโโ Counting_Sort.cpp
โ โโโ Radix_sort.cpp
โโโ
โโโ ๐ Dynamic_progrmaing/
โ โโโ 01Knapsack_brute_forse.cpp
โ โโโ 01Knapsack_dp_bottom_up.cpp
โ โโโ 01Knapsack_dp_top_down.cpp
โ โโโ fibonacci_series.cpp
โ โโโ finding nth number in fibonaci series using dp(bottom up)+space_optimization.cpp
โ โโโ finding nth number in fibonaci series using dp(bottom up).cpp
โ โโโ finding nth number in fibonaci series using dp(top down).cpp
โ โโโ finding nth number in fibonaci series.cpp
โ โโโ lcs_dp_bottom_up.cpp
โ โโโ lcs_dp_top-down.cpp
โ โโโ mcm_brute_forse.cpp
โ โโโ mcm_dp_bottom_up.cpp
โ โโโ mcm_dp_top_down.cpp
โ โโโ simple_lcs.cpp
โโโ
โโโ ๐ greedy_algorithms/
โ โโโ candy_shop _problem.cpp
โ โโโ fractional_knapsack.cpp
โ โโโ huffman_coding.cpp
โ โโโ kruskal's_algorithm.cpp
โ โโโ n number of meetings in a room.cpp
โ โโโ reverse_string.cpp
โโโ
โโโ ๐ Graph Algorithms
โ โโโ Floyd_Warshall Algorithm_APSP.cpp
โ โโโ single_source_shortestPath_using topological_sort in DAG.cpp
โ โโโ topological_sort(bfs) kahn's algorithm.cpp
โ โโโ topological_sort(dfs).cpp
โโโ
โโโ ๐ค String Matching Algorithms
โ โโโ string_matching(knutt_morris_pratt(kmp) algo ).cpp
โ โโโ string_matching(naive approch).cpp
โ โโโ string_matching(rabin_carp Algorithm).cpp
โโโ
โโโ โก Additional Algorithms
โโโ Kirchoff's therom.cpp
We welcome contributions! Please see our Contributing Guidelines for details on:
- ๐ด How to fork and contribute
- ๐ Code style and linting rules
- ๐ Bug reports and feature requests
- ๐งช Testing and documentation updates
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Sorting Algorithms - Shell, Bucket, Counting, Radix sort implementations
- Dynamic Programming - Knapsack, LCS, MCM, Fibonacci variants
- Greedy Algorithms - Huffman coding, MST, fractional knapsack
- Graph Algorithms - Floyd-Warshall, topological sort, shortest paths
- String Matching - KMP, Rabin-Karp, naive approaches
- Advanced Graph Algorithms
- Dijkstra's shortest path algorithm
- Bellman-Ford algorithm
- Prim's algorithm for MST
- Strongly connected components (Tarjan's/Kosaraju's)
- Advanced Dynamic Programming
- Edit distance (Levenshtein distance)
- Optimal Binary Search Tree
- Traveling Salesman Problem (TSP)
- Machine Learning Algorithms
- K-Means clustering
- Linear regression
- Decision trees
- Numerical Algorithms
- Fast Fourier Transform (FFT)
- Matrix operations and decompositions
- Root finding algorithms
- Interactive Visualizations - Web-based algorithm visualization tools
- Performance Benchmarks - Comprehensive time/space complexity analysis
- Python Implementations - Parallel implementations in Python
- Documentation Website - Detailed algorithm explanations with complexity analysis
- Unit Testing Framework - Comprehensive test coverage for all algorithms
- API Development - RESTful API for algorithm execution and analysis
- Introduction to Algorithms by Cormen, Leiserson, Rivest, and Stein (CLRS)
- Algorithm Design by Jon Kleinberg and รva Tardos
- Competitive Programming communities and online judges
- C++ Standard Template Library (STL) for efficient data structures
- GNU Compiler Collection (GCC) for compilation
- Git & GitHub for version control and collaboration
Special thanks to the open-source community and algorithm enthusiasts who contribute to making computer science education accessible to everyone.
Made with โค๏ธ by H0NEYP0T-466