Rust Raid is a repository for Rust learners and coding challenge seekers.
The repository contains solutions to diverse challenges categorized by different topics(workspaces). 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
- 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
- Segment Trees
- Fenwick Trees (Binary Indexed trees)
- Suffix Trees
- Trie
- Disjoint Set
- 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]
- [heap Sort]
- [Counting Sort]
- [Radix Sort]
- [Activity Selection]
- Huffman Coding
cargo run --bin huffman
- [Krushkal's algorithm]
- [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]
- [Backtracking]
- [Divide and Conquer]
- [Branch and Bound]
Note: Topics that do not contain hyperlinks are work in progress and will be updated as soon as the solution gets completed.
You can also create a PR with solution/enhancement to each topics.
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