VecDeque & BinaryHeap
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
VecDeque shton dhe heq shpejt nga të dy skajet — ideal për radhë (BFS). BinaryHeap mban gjithmonë më të madhin në krye — priority queue (me Reverse për më të voglin).
EnglishEN
VecDeque adds and removes quickly at both ends — ideal for queues (BFS). BinaryHeap always keeps the largest on top — a priority queue (with Reverse for the smallest).
Si ta mendosh
Si një radhë me dy hyrje, dhe si urgjenca e spitalit ku kalon i pari më urgjenti.
Lexoje në anglisht
Like a queue with two entrances, and like a hospital ER where the most urgent go first.
Shembull kodirust
let mut radha = VecDeque::from([1, 2]);
radha.push_front(0);
let mut heap = BinaryHeap::from([3, 9, 1]);
println!("{:?}", heap.pop()); // Some(9)