Data Structures Tutorial: The FIFO Queue Data Structure

preview_player
Показать описание
The queue is a fundamental data structure. It is a first in, first out structure that models a line. That is, the first value placed into the queue is going to be the first value to come out.

In this video, we examine the theory and discuss algorithms for an implementation: isFull, isEmpty, enqueue, dequeue, and peek.

We also discuss the need for wrap-around logic which is vital to make this structure perform as it does in constant time, or O(1).

This relies on using either an if statement and assignment statement OR by using the characteristics of the modulus operation. For example:

0 % 5 = 0
1 % 5 = 1
2 % 5 = 2
3 % 5 = 3
4 % 5 = 4
5 % 5 = 5
6 % 5 = 1
.
.
.
Рекомендации по теме
Комментарии
Автор

I'm currently in the process of structuring my code for my OS class that has us using this data structure and you explained it perfectly, thank you

isaacvrba
Автор

Hands down best Video on Queueing! I'm studying it rn at uni and this may have just saved my life :D Couldn't get my algorithms to work but now they do!
Thanks :)

regards from Germany

effin-e
Автор

Could you please share an implementation in something like C? I can really use a code example.

xloppyschannel
Автор

What is a good email to contact you at?

CalmRedheadASMR