VecDeque and BinaryHeap
VecDeque is a double ended queue and BinaryHeap keeps the largest item on top.
Example
fn main() {
use std::collections::{BinaryHeap, VecDeque};
let mut d = VecDeque::new();
d.push_back(1); d.push_front(0);
println!("{:?}", d);
let mut h = BinaryHeap::from(vec![3, 9, 5]);
println!("{:?}", h.pop());
}Result
[0, 1] Some(9)
Exercise
Front insert.
d.(0)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.