Skip to content

hexavik/25-Algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

25 Important Algorithms

This repository documents and implements 25 fundamental algorithms in C++ and Rust. The goal is to keep the code clean, simple, and well-documented. We are open to feedback and improvements!

πŸ“‚ Repository Structure

25-Algorithms/
│── cpp/         # C++ implementations
│── rust/        # Rust implementations
│── README.md    # Documentation
│── CMakeLists.txt (for C++ projects)
│── Cargo.toml   (for Rust projects)

Algorithms Implemented

Algorithm C++ Rust Description
Linear Search βœ… βœ… Searches for an element in an array
Binary Search βœ… βœ… Searches in a shorted array using divide and conquer
Breadth First Search (BFS) Graph traversal algorithm
Depth First Search (DFS) Graph traversal algorithm
Insertion Sort βœ… Sorting algorithm
Selection Sort βœ… Sorting algorithm
Merge Sort βœ… Sorting algorithm using divide and conquer
Quick Sort βœ… Efficient sorting using partitioning
Heap Sort βœ… Sorting using heap data structure
Counting Sort βœ… Non-comparative sorting algorithm
Kruskal's Algorithm Minimum spanning tree algorithm
Floyd Warshall Algorithm Shortest path in weighted graphs
Dijkastra's Algorithm Shortest path algorithm
Bellman Ford Algorithm Shortest path with negative weights
Kadane's Algorithm Maximum sum subarray
Lee Algorithm Shortest path in a grid
Flood Fill Algorithm Graph traversal used in image filling
Floyd's Cycle Detection Algorithm Detects cycles in linked lists
Union Find Algorithm Disjooint set data structure
Topological Sorting in a DAG Ordering in Directed Acyclic Graphs
KMP Algorithm String matching algorithm
Kahn's Topologiocal Sort Algorithm Another way to order DAG
Huffman Coding Compression Algorithm Data compression algorithm
Quickselect Algorithm Selects k-th smallest element in an array
Boyer-Moore Majority Vote Algorithm Finds majority element in an array
Euclid's Algorithm Computes the greatest common divisor (GCD)
In, Pre, Post order Tree Traversal Different ways to traverse tress

How to Run

For C++ (CMake Build)

mkdir build && cd build
cmake ..
make
./binary_search # Example: Run Binary Search

For Rust (Cargo)

cargo run -p binary_search # Example: Run Binary Search

Contributions & Feedback

πŸ’‘ Have suggestions or improvements? Feel free to contribute or open an issue!

About

Implmentation and explanation of 25 most important algorithms in C++ and Rust

Topics

Resources

Stars

Watchers

Forks