Complete the code to add an element to the end of a queue.
queue.push_back([1]);To add an element to the end of a queue, use push_back() with the element as argument.
Complete the code to remove the top element from a stack.
stack.[1]();In Rust's Vec used as a stack, pop() removes the last element (top of stack).
Fix the error in the code to peek at the front element of a queue without removing it.
let front = queue.[1]();Rust's VecDeque has a front() method to peek at the front element without removing it. It returns Option<&T>.
Fill both blanks to create a stack and add an element to it.
let mut stack = Vec::[1](); stack.[2](10);
To create a new empty stack, use Vec::new(). To add an element, use push().
Fill all three blanks to create a queue, add an element, and remove the front element.
use std::collections::VecDeque; let mut queue = VecDeque::[1](); queue.[2](5); let front = queue.[3]();
Create a new queue with VecDeque::new(), add element with push_back(), and remove front element with pop_front().
