This repository is a comprehensive collection of essential algorithms in computer science, implemented in Python. It includes implementations of classic algorithms for graph theory, dynamic programming, scheduling, and optimization. Each algorithm is designed to be modular and easy to integrate into larger projects, making this a valuable resource for both learning and practical applications.
The repository includes the following algorithms:
-
Graph Algorithms
- Dijkstra's Algorithm (
dijkstra_algorithm.py): Finds the shortest path in a weighted graph. - Ford-Fulkerson Algorithm (
ford_fulkerson_MaxFlow.py): Computes the maximum flow in a flow network. - Kruskal's Algorithm (
kruskal_algorithm.py): Finds the minimum spanning tree of a graph. - Prim's Algorithm (
prims_algorithm.py): Another approach for finding the minimum spanning tree.
- Dijkstra's Algorithm (
-
Optimization and Scheduling
- Knapsack Algorithm (
knapsack.py): Solves the 0/1 knapsack problem. - Interval Scheduling (
interval_scheduling.py): Finds an optimal subset of non-overlapping intervals.
- Knapsack Algorithm (
-
String Matching
- Levenshtein Distance (
levenshtein_distance.py): Calculates the minimum edit distance between two strings.
- Levenshtein Distance (
-
Encoding
- Huffman Coding (
huffmans_code_algorithm.py): Lossless data compression algorithm.
- Huffman Coding (
-
Other Algorithms
- Stable Matching (
stable_matching.py): Solves the stable matching problem. - Kahn's Algorithm (
kahns_algorithm.py): Topological sorting of a directed graph.
- Stable Matching (
- Clone this repository to your local machine.
git clone https://github.com/yourusername/DataStructures-and-Algorithms.git
- Navigate to the project directory.
cd DataStructures-and-Algorithms - (Optional) Set up a virtual environment.
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
Each algorithm can be executed independently. For example, to run Dijkstra's Algorithm:
python dijkstra_algorithm.pyKhalil Ibrahim
Master's Student in Machine Learning