Загрузка...

Data Structures Tutorial: The FIFO Queue Data Structure

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 . . .

Видео Data Structures Tutorial: The FIFO Queue Data Structure автора Python открытия
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки