Menu
Coddy logo textTech
Learning path

Data Structures and Algorithms in Rust

Rust's standard library has most of the structures (Vec, VecDeque, HashMap, BTreeMap, BinaryHeap), and the borrow checker has opinions about the ones you write yourself: a singly linked list is Option<Box<Node>>, and a tree with parent links needs Rc, RefCell and Weak. This path has you build each structure in Rust, then sort, recurse and search graphs with them, and finish on graded interview problems. Free, in your browser, with a certificate on most courses.

377 lessons228 challenges702 quiz questions

DSA in Rust, step by step

38 courses377 lessons228 challenges702 quiz questions

Each step is a set of existing Coddy courses, and every Start button opens them in Rust. The three courses not taught in Rust yet are listed after the steps.

  1. 1
    Start this stepStartStack, queue, binary tree, hash table and linked list, each built from scratch in Rust and then used to solve problems. In Rust a node that owns the next is an Option<Box<Node>>, so this is where ownership starts to feel natural, and after it you know what Vec, VecDeque and HashMap do for you.Start
  2. 2
    Start this stepStartDoubly linked list, heaps and priority queues, tries, graphs and the self-balancing AVL tree. The doubly linked list is the hard one in Rust, since two links lead to every node; after this step BinaryHeap is a heap you have written, max-first by default, and BTreeMap an ordered tree you understand.Start
  3. 3
    Start this stepStartBubble, selection, insertion, merge, quick, heap, counting and radix sort, written in Rust and watched in the visualizer. sort is stable and sort_unstable usually faster; after this step you can say what stability costs and when to give it up.Start
  4. 4
    Start this stepStartRecursion challenges in Rust. A recursive type needs a Box before the compiler will give it a size, and a recursive function over it matches each case, Some or None, the way a base case and a recursive case split. Rust promises no tail-call optimization, so a recursion deep enough overflows the stack and aborts the program. Dynamic programming and bit manipulation are listed after the steps, since they are taught in Python and C++.StartDedicated page
  5. 5
    Start this stepStartBreadth-first and depth-first search, Dijkstra, Bellman-Ford, topological sort, Kruskal and Prim in Rust, on the graph you built in step two. Dijkstra's priority queue in Rust is a BinaryHeap of Reverse((distance, node)): the heap from step two, turned into a min-heap.Start
  6. 6
What you get
Everything you'll use to learn to code

Learn by Doing

Write real code, query databases, build websites, and master AI prompts. Our interactive lessons cover every skill modern developers need.

playground.js
Code Editor
1const greeting = "Hello, Coddy!"
2function sayHi(name) {
3    return greeting + " " + name
4}
5
bottombar Collapse icon
Test #1test Case Success icon
Test #2test Case Success icon
Test #3test Case Failure icon
Input
"Alex"
Output
"Hello, Coddy! Alex"

Build Your Coding Streak

Stay consistent and watch your progress grow! Track your daily coding habit, protect your streak with freeze days, and earn rewards for showing up every day.

12 days streak

Return tomorrow to keep your streak!

fire Filled icon
left icon

January 2026

right icon

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

21

22

23

24

25

26

27

28

29

30

product Double Or Nothing icon

Double or Nothing

Day 5 of 7

fire Freeze icon

Streak Freeze

2 left

Code Anywhere, Anytime

Take your coding journey on the go! No setup, no downloads - just open and start coding. Available on iOS, Android and Web with 4.9 star ratings.

Python
7Streak
250Score
5Energy
Variables
journey Hex Done Base iconjourney Hex Done Shadow iconjourney Hex Done Top iconjourney Lesson Done icon
journey Path Right Done icon
journey Hex Done Base iconjourney Hex Done Shadow iconjourney Hex Done Top iconjourney Lesson Done icon
journey Path Left Done icon
journey Hex Active Base iconjourney Hex Active Shadow iconjourney Hex Active Top iconjourney Lesson Theory Challenge icon
CONTINUE
journey Path Right icon
journey Hex Locked Base iconjourney Hex Locked Shadow iconjourney Hex Locked Top iconjourney Lesson Theory Challenge icon
journey Path Left icon
journey Hex Locked Base iconjourney Hex Locked Shadow iconjourney Hex Locked Top iconjourney Lesson All icon
Journey
Goals
Leaderboard
Profile
4.9
StarStarStarStarStar
Rating

You're Not Alone in This

Compete on global leaderboards, invite friends to earn rewards, and celebrate each other's wins. Coding is better with friends!

Challenger League
Challenger LeagueTop 7 advance
leaderboard First icon1
avatar 1 icon
fire Filled icon
Alex7+ Days
2840
leaderboard Second icon2
avatar 2 icon
fire Filled icon
Jordan7+ Days
2650
leaderboard Third icon3
avatar 3 icon
fire Filled icon
Sam7+ Days
2420
4
avatar 4 icon
Casey
2180
5
avatar placeholder icon
fire Filled icon
Morgan7+ Days
1950
leaderboard Arrow Up iconPromotion zoneleaderboard Arrow Up icon

Every way to learn

Read, listen, test yourself, ask the AI, or look up anything you've already covered. Every lesson meets you where you are.

Intro to Variables
Audio

A variable is a named container that stores a value you can reference later in your program.

In Python, you create one by writing the name, an equals sign, then the value you want to store.

The value can change over time - reassigning the name simply points it to a new value.

1xSarah

Prove Your Skills

Earn certificates for every course you complete. Add them to your LinkedIn profile and resume to showcase your coding expertise to employers.

CoddyCertificate of Completion
This certifies thatJohn Doehas successfully completed
python iconPython Fundamentals
Verified
DateJan 2026
LinkedInAdd to LinkedIn

Why learn DSA in Rust on Coddy

  • Ownership where it is hardest. Linked lists and trees are where Rust's rules bite first: every value has one owner, and these structures want nodes that point at each other. Writing them is where Box, Option::take, Rc<RefCell<T>> and Weak stop being syntax and become decisions, which is why a well-known guide to the language is called Learning Rust With Entirely Too Many Linked Lists.
  • Collections with clear costs. Vec<T> is your stack, VecDeque<T> a ring buffer and your queue, HashMap a hash table seeded against deliberate collisions, BTreeMap an ordered B-tree and BinaryHeap<T> a max-heap. Build the structures once and you know which one a problem wants, and why Dijkstra wraps its entries in Reverse.
  • Nearly the whole path in Rust. Every data structure, sort, graph algorithm, recursion challenge and interview pack is taught in Rust. Three are taught elsewhere and listed after the steps with a link to each: dynamic programming and the Python interview series in Python, and bit manipulation in C++. Bit manipulation carries over with one change of spelling: Rust writes NOT as !x, and counts set bits with count_ones().
  • Graded like an interview. Every lesson ends in a Rust challenge checked by test cases, and when one fails or will not compile, Bugsy reads your code and nudges you toward the fix without handing over the answer. A free certificate on most courses, each verifiable at its own URL.

Frequently asked questions about DSA in Rust

Is Rust good for data structures and algorithms?

For using them, very: the standard collections are fast and well documented, sort is stable, and safe Rust rules out dangling pointers and data races at compile time, with no garbage collector. For writing pointer-based structures, it is harder than C or Java, because ownership rules out shared, mutable links unless you opt into Rc and RefCell, and a doubly linked list or a tree with parent pointers is made of exactly those. That difficulty is also the lesson: once you can write them in Rust, you know exactly who owns what.

Which Rust collections match which data structures?

Vec<T> is a dynamic array and your stack, VecDeque<T> is a ring buffer and your queue, HashMap and HashSet are hash tables (SipHash by default, which resists deliberate collisions at some cost in speed), BTreeMap and BTreeSet are ordered B-trees, BinaryHeap<T> is a max-heap, and LinkedList<T> is a doubly linked list you will rarely want over a Vec or a VecDeque. There is no trie or graph type; those you build.

Why is a linked list so hard to write in Rust?

Because every value has exactly one owner. A singly linked list fits that rule: each node owns the next through Option<Box<Node>>. A doubly linked list or a tree with parent links does not, since two pointers lead to every node, so you reach for Rc<RefCell<Node>> with Weak for the back links, or keep the nodes in a Vec and link them by index. Learning Rust With Entirely Too Many Linked Lists exists because so many people get stuck exactly here.

How do I get a min-heap in Rust?

BinaryHeap<T> is a max-heap, so wrap each item in std::cmp::Reverse: push Reverse(x) and the smallest x comes out first. For Dijkstra, push Reverse((distance, node)), and the tuple compares by distance first. Once you have written a heap yourself in step two, flipping its order is obvious.

Which courses on this path are not taught in Rust?

Three: dynamic programming and the Python interview series, taught in Python, and bit manipulation, taught in C++. They are listed after the steps, each with a link that opens it in its own language. A memo table in Rust is a Vec or a HashMap, and integer overflow panics in a debug build, so a bit trick that relies on wrapping spells it out with wrapping_add or wrapping_mul.

Do I need to know Rust before starting this path?

Ownership, borrowing, structs, enums and Option, at least; Box and traits help. If those are new, Coddy's Rust course takes you there first, free, and this path picks up where it ends.

Other learning paths

The same courses, arranged for a different role. Progress carries over: a course finished on one path counts on every path that includes it.

All learning paths
Coddy programming languages illustration

Start the Data Structures & Algorithms path for free

Start learning