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 (specially WSL), the following packages might need to be installed to run some binaries that require network request.
pkg-config
libssl-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:
Algorithms
that can be used to solve various problems.Examples
of differentdesign patterns
anddata structures
.solutions
to diverse challenges categorized by different topics(workspaces).advanced concepts
that include memory management, multiprocessing, etc.Demo projects
to polish your skills to the depth.
Each workspace contains multiple binaries so that it will be easier to run 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 huffman
Note: 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 solution/enhancement to each topics.
- Arrays
- Find the missing number
cargo run --bin ds001
- Find the length of the longest sub-array 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 2 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/Await
andFutures
cargo 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
Result
enumcargo 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
- Writing a custom allocator
- Self-referential structs (
box
,rc
,Arc
)
- Python's
Pandas
like dataframe containercargo run --bin pandas
ruscrypt
basic encryptioncargo run --bin ruscrypt
- Basic Password
vault
cargo run --bin vault
- Basic
TODO
Web Applicationcargo run --bin todo
- File Downloader with Concurrency
To run any binary, you can run the command cargo run --bin <bin_name>
Example:
cargo run --bin practical_number
Note: 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 thedocstring
of the respective solution. some examples of shorter version of solution name are as follows:
- The binary for
huffman_coding.rs
is justhuffman
.
There are test cases for each functions/challenges which 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