C++

std::queue & std::stack

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

std::queue është radha: i pari që hyn, i pari që del (push/pop/front). std::stack është pirgu: i fundit që hyn, i pari që del (push/pop/top). Përdoren shumë në algoritme si BFS dhe DFS.

EnglishEN

std::queue is a queue: first in, first out (push/pop/front). std::stack is a stack: last in, first out (push/pop/top). They're used a lot in algorithms like BFS and DFS.

Si ta mendosh

queue është radha në bankë; stack është pirgu i pjatave për të larë.

Lexoje në anglisht

queue is the line at the bank; stack is the pile of plates waiting to be washed.

Shembull kodicpp

std::queue<std::string> radha;
radha.push("Arta"); radha.push("Dren");
std::cout << radha.front();   // Arta
radha.pop();

Terma të lidhur