From the course: Rust for Data Engineering
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Creating a fig-priority fruit salad using BinaryHeap in Rust - Rust Tutorial
From the course: Rust for Data Engineering
Creating a fig-priority fruit salad using BinaryHeap in Rust
- [Instructor] All right, in this video I'm going to make a Rust program that creates a fruit salad, but it has a twist here in that I'm going to assign the fruit fig, which is one of my favorite fruits, the priority. And this program uses the Binary Heap to accomplish this. And the Rust Standard Library is able to actually build this for us, which is nice. Binary Heap comes from standard library collections. And the first thing that we're going to take a look at is there's an enum here, which is a fig, and other. And then in this particular scenario here, I'm going to define figs as the highest priority by implementing Ord. So I say implement Ord. So basically make the order here. And I'm going to say that, basically, figs here are going to be at the top and then other fruits are going to be at the bottom, here. And then I also have partial order as well. And then finally, I get into the generation of the fruit salad. So…
Contents
-
-
-
-
Analyzing UFC fighter network using graph centrality in Rust4m 12s
-
(Locked)
Storing unique fruits using HashSet in Rust3m 18s
-
(Locked)
Maintaining sorted and unique fruits using BTreeSet in Rust2m 35s
-
(Locked)
Creating a fig-priority fruit salad using BinaryHeap in Rust2m 42s
-
(Locked)
PageRank algorithm for sports data4m 12s
-
(Locked)
Showing shortest path with Dijkstra3m 27s
-
(Locked)
Detecting strongly connected components: A deep dive into Kosaraju's algorithm4m 14s
-
(Locked)
Simple charting of data structures in Rust2m 26s
-
-
-
-
-
-
-
-
-
-