DISCLAIMER !!
This project is not affiliated with, endorsed by, or sponsored by the Rust Foundation or the Rust programming language project. "Rust" and the Rust logo are trademarks of the Rust Foundation. For details on trademark usage, please refer to the Rust Foundation Trademark Policy.
Rust Raid is a repository for Rust learners and coding challenge seekers.
Note: In some linux distributions (especially WSL), the following packages might need to be installed to run some binaries that require network request.
pkg-configlibssl-devExample commands for installing in ubuntu
sudo apt install pkgconf sudo apt install libssl-devYou can check similar commands for other distributions
The repository contains the following:
Algorithmsthat can be used to solve various problems.Examplesof differentdesign patternsanddata structures.solutionsto diverse challenges categorized by different topics(workspaces).advanced conceptsthat include memory management, multiprocessing, etc.Demo projectsto polish your skills to the depth.
Each workspace contains multiple binaries so that it will be easier to run a specific problem by selecting binaries.
You can run the cargo run --bin <binary_name> to run binaries. To run all test cases,
you can run cargo test command, or to run specific test, you can run
cargo test --bin <binary_name>
# Example: running binary for huffman encoding
cargo run --bin huffman
cargo test --bin huffmanNote: Topics that do not contain hyperlinks are work in progress and will be updated once the solution gets completed.
You can also create a PR with the solution/enhancement to each topic.
- Arrays
- Find the missing number 
cargo run --bin ds001 - Find the length of the longest subarray with sum K 
cargo run --bin ds002 
 - Find the missing number 
 - Singly Linked Lists
- Add two linked list 
cargo run --bin ds101 
 - Add two linked list 
 - Doubly Linked Lists 
cargo run --bin doubly_linked_list - Stacks 
cargo run --bin stack - Queues 
cargo run --bin queue - Binary Trees 
cargo run --bin binary_tree - Trie 
cargo run --bin trie 
- Linear Searching 
cargo run --bin linear_search - Binary Searching 
cargo run --bin binary_search - [Depth First Search (DFS)]
 - [Breadth First Search (BFS)]
 
- bubble sort 
cargo run --bin bubble_sort - selection sort 
cargo run --bin selection_sort - insertion sort 
cargo run --bin insertion_sort - quick sort 
cargo run --bin quick_sort - Merge sort 
cargo run --bin merge_sort - [heap Sort]
 - [Counting Sort]
 - [Radix Sort]
 
- [Activity Selection]
 - Huffman Coding 
cargo run --bin huffman - Krushkal's algorithm 
cargo run --bin kruskal - [Prim's Algorithm]
 - [Dijkstra's Algorithm]
 - [Bellman-Ford Algorithm]
 - [Floyd-Warshall Algorithm]
 - [Topological Sort]
 - [A* Search Algorithm]
 
- Singleton Pattern 
cargo run --bin singleton - Factory Pattern 
cargo run --bin factory - Builder Pattern 
cargo run --bin builder - Decorator Pattern 
cargo run --bin decorator - Observer Pattern 
cargo run --bin observer - Strategy Pattern 
cargo run --bin strategy - Command Pattern 
cargo run --bin command - Adapter Pattern 
cargo run --bin adapter 
- Practical Number  
cargo run --bin practical_number - Greatest Common Divisor 
cargo run --bin gcd - Median 
cargo run --bin median - Reverse digits of the integer 
cargo run --bin reverse_integer - List Comprehension 
cargo run --bin comprehension - Linear Regression Model 
cargo run --bin linear_regression - Matrix Multiplication Model 
cargo run --bin matrix_multiplication - Color Converter 
cargo run --bin color_converter 
- List group by consecutive numbers 
cargo run --bin consecutive_groups - Find the length of the longest substring with maximum 2 repetition
cargo run --bin repeat - Find the index of two numbers in an array whose sum equals to the provided target 
cargo run --bin two_sum - Minimize the Sum from an array 
cargo run --bin minimize_sum - Fibonacci Series 
cargo run --bin fibonacci - Longest Common Subsequence 
cargo run --bin lcs - Coin Change Problem 
cargo run --bin coin_change - Palindrome Partition 
cargo run --bin palindrome_partition 
- Ownership, borrowing, and Lifetimes 
cargo run --bin ownership - Unsafe Rust
 
- Generic Types 
cargo run --bin generics - Trait Objects and Dynamic Dispatch 
cargo run --bin traits - Associated types and Generic Type parameters
 - Lifetime Sub-typing
 
Async/AwaitandFuturescargo run --bin threading- Thread Spawning 
cargo run --bin spawning 
macro_rules!cargo run --bin macro- Derive Macros 
cargo run --bin derive - Building Domain-Specific Languages (DSL) 
cargo run --bin dsl 
- Conditional Compilation 
cargo run --bin cc - Inline Assembly 
cargo run --bin assembly - Foreign Function Interface (FFI)
 - Embedded rust and Bare-metal programming
 
- Unrecoverable error and 
panic!macrocargo run --bin panic - Recoverable error and 
Resultenumcargo run --bin result - Advanced Error Handling
- Propagating Errors with 
?operatorcargo run --bin propagation - Custom Errors 
cargo run --bin custom-error 
 - Propagating Errors with 
 - Dependency Injection patterns in rust
 
5.7. Operator Overloading cargo run --bin operator-overloading
- Example 1: Operator Overloading in structs (overloading 
+and-operators) - Example 2: Matrix Multiplication ( overloading 
*operator) - Example 3: Scalar Multiplication (operator overloading with heterogeneous data type)
 
- Box Pointers 
cargo run --bin box - Reference Counters (
Rc)cargo run --bin rc RefCellcargo run --bin refcellArc Mutexcargo run --bin arc-mutex
- Writing a custom allocator
 - Self-referential structs (
box,rc,Arc) 
- Python's 
Pandaslike dataframe containercargo run --bin pandas ruscryptbasic encryptioncargo run --bin ruscrypt- Basic Password 
vaultcargo run --bin vault - Basic 
TODOWeb Applicationcargo run --bin todo wget-like File Downloader with Concurrency -cgetcargo run --bin cget <DOWNLOAD_URL>Example:cargo run --bin cget https://filesamples.com/samples/document/docx/sample4.docx
To run any binary, you can run the command cargo run --bin <bin_name>
Example:
cargo run --bin practical_numberNote: Binary names might not always be the name of the file. Sometimes, a shorter version of the solution name is used to make easier to type. You can see the name of binary in the respective
README.mdfile or thedocstringof the respective solution. Example:
- The binary for
 huffman_coding.rsis justhuffman.
There are test cases for each function/challenge that will be beneficial for you to learn testing as well as test programs for errors.
To test programs, you can run cargo test command.
Example:
cargo test
# alternatively, to test individual binary, you can run
cargo test --bin your_program_name