A curated collection of Data Structures and Algorithms implemented in Rust, focused on clarity, correctness, and performance.
Rust 100.0%
5 1 0

Clone this repository

https://tangled.org/mhhegazy.tngl.sh/dsa-rust
git@tangled.org:mhhegazy.tngl.sh/dsa-rust

For self-hosted knots, clone URLs may differ based on your setup.

README.md

Rust Data Structures & Algorithms (DSA)#

A curated collection of Data Structures and Algorithms implemented in Rust, focused on clarity, correctness, and performance.

This repository is intended for:

  • Learning Rust through practical problem solving
  • Understanding classic DSA concepts
  • Preparing for coding interviews
  • Practicing idiomatic and safe Rust

Problems#

Blind 75#

Array & Hashing#

Two Pointers#

  • Valid Palindrome [#125] src/two_pointers/is_palindrome.rs
  • 3 Sum [#15] src/two_pointers/three_sum.rs
  • Container With Most Water [#11] src/two_pointers/max_area.rs

Sliding Window#

  • Best Time to Buy and Sell Stock [#121] src/sliding_window/max_profit.rs
  • Longest Substring Without Repeating Characters [#3] src/sliding_window/length_of_longest_substring.rs
  • Longest Repeating Character Replacement [#424] src/sliding_window/character_replacement.rs
  • Minimum Window Substring [#76] src/sliding_window/min_window.rs

Stack#

  • Valid Parentheses [#20] src/stack/is_valid_parentheses.rs
  • Find Minimum In Rotated Sorted Array [#153] src/binary_search/find_min.rs
  • Search In Rotated Sorted Array [#33] src/binary_search/search.rs

Linked List#

  • Reverse Linked List [#206] src/linked_list/reverse_list.rs
  • Merge Two Sorted Lists [#21] src/linked_list/merge_two_lists.rs
  • Linked List Cycle [#141] src/linked_list/has_cycle.rs
  • Reorder List [#143] src/linked_list/reorder_list.rs
  • Remove Nth Node From End of List [#19] src/linked_list/remove_nth_from_end.rs
  • Merge K Sorted Lists [#23] src/linked_list/merge_k_lists.rs

Trees#

  • Invert Binary Tree [#226] src/trees/invert_tree.rs
  • Maximum Depth of Binary Tree [#104] src/trees/max_depth.rs
  • Same Tree [#100] src/trees/is_same_tree.rs
  • Subtree of Another Tree [#572]
  • Lowest Common Ancestor of a Binary Search Tree [#235]
  • Binary Tree Level Order Traversal [#102]
  • Validate Binary Search Tree [#98]
  • Kth Smallest Element In a Bst [#230]
  • Construct Binary Tree From Preorder And Inorder Traversal [#105]
  • Binary Tree Maximum Path Sum [#124]
  • Serialize And Deserialize Binary Tree [#297]

Heap / Priority Queue#

  • Find Median From Data Stream [#295]

Backtracking#

Tries#

  • Implement Trie Prefix Tree [#208]
  • Design Add And Search Words Data Structure [#211]
  • Word Search II [#212]

Graphs#

  • Number of Islands [#200]
  • Clone Graph [#133]
  • Pacific Atlantic Water Flow [#417]
  • Course Schedule [#207]
  • Graph Valid Tree [#261]
  • Number of Connected Components In An Undirected Graph [#323]

Advanced Graphs#

1-D Dynamic Programming#

2-D Dynamic Programming#

Greedy#

Intervals#

Math & Geometry#

Bit Manipulation#