C++ Data StructuresLesson 51Free preview
C++ Queues
This lesson is part of C++ · All levels
Summary
Queues are containers with the FIFO principle (first in, first out): the first element that enters is the first to be served. New elements are always added on the back with push(), and the pickup is done from the front using front() to read and pop() to delete. This structure mimics real queues so it is suitable for queue systems, scheduled tasks, and message processing.
Key points
- The working principle of queue is FIFO: first in, first out.
- Add the back, delete the front.
- Read the front element, read the back element.
- Like a stack, queue is an adapter and default is using a deque.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.