Data Structures: Queues

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

flashcard set

Earn XP

Description and Tags

This flashcard set covers the Queue Abstract Data Type (ADT), its operations, Python implementation details using circular arrays, and time complexity.

Last updated 3:02 PM on 5/3/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

20 Terms

1
New cards

Queue ADT

A data structure that stores arbitrary objects where insertions and deletions follow the first-in first-out (FIFO) scheme.

2
New cards

FIFO

Acronym for first-in first-out, meaning insertions are performed at the rear and removals are performed at the front.

3
New cards

enqueue(object)

A main queue operation that inserts an element at the end of the queue.

4
New cards

dequeue()

A main queue operation that removes and returns the element at the front of the queue.

5
New cards

first()

An auxiliary operation that returns the element at the front of the queue without removing it.

6
New cards

len()

An auxiliary operation that returns the integer number of elements stored in the queue.

7
New cards

is_empty()

A boolean auxiliary operation that indicates whether no elements are stored.

8
New cards

EmptyQueueException

The exception thrown when attempting the execution of dequeue or front on an empty queue.

9
New cards

Circular fashion

The use of an array of fixed size NN to store queue elements to avoid shifting elements up when an element is removed from position 0.

10
New cards

f

A variable tracking the index of the front element in an array-based queue implementation.

11
New cards

size

A variable tracking the current number of elements in the queue.

12
New cards

r

In diagram representations, this variable represents the index of the first element after the end of the queue, calculated using (f+extsize)extmodlen(Q)(f + ext{size}) ext{ mod len}(Q), where the queue may be in normal or wrapped-around configuration.

13
New cards

Wrapped-around configuration

A state in circular array implementations where the rear index precedes the front index because the queue has wrapped around the end of the array.

14
New cards

resize(n)

An algorithm that occurs when the number of elements equals the capacity of the list (extsize=extlen(Q)ext{size} = ext{len}(Q)), involving copying elements to a new list of capacity nn, typically using 2imesextlen(Q)2 imes ext{len}(Q).

15
New cards

_data

A reference to a Python list instance with a fixed capacity used as the underlying storage structure for the queue.

16
New cards

_size

An integer instance variable representing the current number of elements stored in the queue as opposed to the length of the data list.

17
New cards

_front

An integer representing the index within data of the first element of the queue.

18
New cards

DEFAULT_CAPACITY

A constant set to 1010 providing a moderate capacity for all new ArrayQueue instances.

19
New cards

O(1)

The time complexity for all standard queue operations including enqueue(e), dequeue(), first(), is_empty(), and len(Q).

20
New cards

Dequeue (as an ADT)

An abstract data type that allows elements to be added and deleted from both the front and back of the queue.