Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Deque

Rust

#![allow(unused)]
fn main() {
use std::collections::VecDeque;

let mut d = VecDeque::from([2,3]);
d.push_back(4);
d.push_front(1);
d.pop_back();
d.pop_front();
}

Python

from collections import deque

d = deque([2,3])
d.append(4)
d.appendleft(1)
d.pop()
d.popleft()