Important
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-dev
Example 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
-
cargo run --bin missing-number
-
Find the length of the longest subarray with sum K
cargo run --bin longest-subarray
-
-
Singly Linked Lists
-
Add two numbers represented by linked list
cargo run --bin linked-list-add
-
-
cargo run --bin doubly_linked_list
-
cargo run --bin stack
-
cargo run --bin queue
-
cargo run --bin binary_tree
-
cargo run --bin trie
-
cargo run --bin linear-search
-
cargo run --bin binary-search
-
cargo run --bin jump-search
-
[Interpolation Search]
-
cargo run --bin bubble_sort
-
cargo run --bin selection_sort
-
cargo run --bin insertion_sort
-
cargo run --bin quick_sort
-
cargo run --bin merge_sort
-
[heap Sort]
-
[Counting Sort]
-
[Radix Sort]
-
[Activity Selection]
-
cargo run --bin huffman
-
cargo run --bin kruskal
-
[Prim's Algorithm]
-
[Dijkstra's Algorithm]
-
[Bellman-Ford Algorithm]
-
[Floyd-Warshall Algorithm]
-
[Topological Sort]
-
An example of a package manager to resolve and install dependencies using DFS algorithm.
cargo run --bin dfs
-
[Breadth First Search (BFS)]
-
[A* Search Algorithm]
-
Luhn's algorithm to validate credit card number.
cargo run --bin luhn cargo test --bin luhn
-
cargo run --bin singleton
-
cargo run --bin factory
-
cargo run --bin builder
-
cargo run --bin decorator
-
cargo run --bin observer
-
cargo run --bin strategy
-
cargo run --bin command -
cargo run --bin adapter
-
cargo run --bin practical_number
-
cargo run --bin gcd
-
cargo run --bin median
-
cargo run --bin reverse_integer
-
cargo run --bin comprehension
-
cargo run --bin linear_regression
-
cargo run --bin matrix_multiplication
-
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
-
cargo run --bin fibonacci
-
cargo run --bin lcs
-
cargo run --bin coin_change
-
cargo run --bin palindrome_partition
-
cargo run --bin nth-distinct-number
-
Find the length of the longest substring without duplicates
cargo run --bin longest-substring
-
Ownership, borrowing, and Lifetimes
cargo run --bin ownership
-
cargo run --bin unsafe
-
cargo run --bin generics
-
Trait Objects and Dynamic Dispatch
cargo run --bin traits
-
Associated types and Generic Type parameters
-
Lifetime Sub-typing
-
cargo run --bin threading
-
cargo run --bin spawning
-
cargo run --bin macro
-
cargo run --bin derive
-
Building Domain-Specific Languages (DSL)
cargo run --bin dsl
-
cargo run --bin cc
-
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
-
cargo run --bin custom-error
-
-
Dependency Injection patterns in rust
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)
-
cargo run --bin box
-
cargo run --bin rc
-
cargo run --bin refcell
-
cargo run --bin arc-mutex
- Writing a custom allocator
- Self-referential structs (
box,rc,Arc)
Command:
cargo run --bin pandasCommand:
cargo run --bin ruscryptCommand:
cargo run --bin vaultCommand:
cargo run --bin todoand browse: http://localhost:8080
Command: cargo run --bin cget <DOWNLOAD_URL>
Example:
cargo run --bin cget https://mirrors.saswata.cc/kde/stable/krita/5.2.14/krita-x64-5.2.14-setup.exeNote
furl-cli (or fURL) is a successor to this project. It incorporates refined logic, improved multithreading, and other features such as better error handling, and pause and resume download from the original implementation.
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.md file or the docstring
of 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

