This repository hosts a diverse collection of implemented algorithms across various domains in computer science. From foundational searching and sorting techniques to advanced graph algorithms and dynamic programming, this repository provides a comprehensive resource for understanding and implementing essential algorithms.
Fundamental methods for locating elements in collections.
- Linear Search – sequentially checks each element (O(n)).
- Binary Search – efficiently searches sorted data (O(log n)).
Classic algorithms for ordering data.
- Selection Sort – repeatedly selects the minimum element (O(n²)).
- Insertion Sort – builds a sorted list one element at a time (O(n²)).
- Count Sort – non-comparison sort using element frequency (O(n + k)).
Solves problems by recursively dividing them into subproblems.
- Merge Sort – stable and efficient divide-and-conquer sort (O(n log n)).
- Quick Sort – efficient in practice with average-case O(n log n).
Algorithms for traversing and processing graphs.
- Graph Breadth First Search – explores neighbors level by level.
- Graph Depth First Search – explores as deep as possible before backtracking.
- Shortest Path Algorithms:
- Floyd–Warshall – all-pairs shortest paths (O(n³)).
- Bellman–Ford – handles negative weights.
- Dijkstra – shortest path with non-negative weights (O(m + n log n)).
- Minimum Spanning Trees:
- Prim's – grows MST by adding the lowest weight edge.
- Kruskal's – builds MST by merging disjoint sets.
- Kahn's Algorithm – orders nodes in a directed acyclic graph (DAG).
Solves problems by combining solutions to subproblems with overlapping states.
Explores decision trees by trying all possibilities and backtracking when needed.
Efficient algorithms for searching substrings in text.
- Rabin–Karp – uses a rolling hash for multiple pattern matching.
- Knuth–Morris–Pratt (KMP) – uses prefix function for linear-time pattern search.