Back to marketplace

1.4.2 Data structures definitions/info

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

What is a stack?

Back (Answer)

A data structure which follows a last in, first out (LIFO) structure - holds an ordered, linear sequence of items

#2
Front (Question)

what is needed to keep track of a stack?

Back (Answer)

a pointer which points to the top of the stack

#3
Front (Question)

what is the operation to add an item to a stack?

Back (Answer)

push - adds an element to the top of a stack

#4
Front (Question)

what is the operation to remove an item from a stack?

Back (Answer)

pop - removes an element from the top of the stack

#5
Front (Question)

what is the peek operation?

Back (Answer)

returns a copy of the element on the top of the stack without removing it

#6
Front (Question)

what are the steps for the push operation?

Back (Answer)

• check if the stack is full • add an item by incrementing the pointer by 1 and then inserting the item into the array at the pointer

#7
Front (Question)

what are the steps for the pop operation?

Back (Answer)

• checks if the stack is empty • store the item at the top of the stack (at the index equal to the pointer) • reduce the pointer by 1 • return the item

#8
Front (Question)

what are the steps for the peek operation?

Back (Answer)

• return the item at the top of the stack (at the index equal to the pointer)

#9
Front (Question)

what other functions can there be for a stack?

Back (Answer)

is_empty - checks if the stack is empty is_full - checks if the stack is at maximum capacity when stored in a static structure

#10
Front (Question)

what is a static data structure?

Back (Answer)

a data structure of fixed size

#11
Front (Question)

what are the ways a stack can be implemented?

Back (Answer)

• using a static array • using a dynamic linked list

#12
Front (Question)

what is a queue?

Back (Answer)

a data structure which follows first in, first out (FIFO) structure - holds an ordered linear sequence of items

#13
Front (Question)

what is the operation to add an item to a queue?

Back (Answer)

enqueue - adds an element to the queue

#14
Front (Question)

what is the operation to remove an item from a queue?

Back (Answer)

dequeue - removes an element from the front of the queue

#15
Front (Question)

what is needed to keep track of a queue?

Back (Answer)

• a pointer at the front • a pointer at the back/rear

#16
Front (Question)

what other operations can a queue have?

Back (Answer)

• is_empty - checks if the queue is empty • is_full - checks if the queue is full

#17
Front (Question)

what are the steps for the enqueue operation? (for linear queues)

Back (Answer)

• check if the queue is full • increment the back/rear pointer • add the item to where the back/rear is pointing to • check if this is the first item to be added to the queue (if the front pointer = -1) and if so, sets the front pointer to 0

#18
Front (Question)

what are the steps for the dequeue operation? (for linear queues)

Back (Answer)

• check if the queue is empty • store the item at the front of the queue in a variable • increment the front pointer • return the item

#19
Front (Question)

what is a circular queue?

Back (Answer)

a queue which reuses the empty slots at the front of the queue when elements are dequeued

#20
Front (Question)

how does a circular queue work?

Back (Answer)

• as items are enqueued, and the rear pointer reaches the last position, it wraps around to point at the start of the array • as items are dequeued, the front pointer will wrap around until it passes the rear pointer

#21
Front (Question)

how is the enqueue operation adjusted for circular queues?

Back (Answer)

• use an additional check to cycle back to the beginning if there is free space

#22
Front (Question)

how is the dequeue operation adjusted for circular queues?

Back (Answer)

• use an additional check to cycle to the beginning of the queue

#23
Front (Question)

what is a priority queue?

Back (Answer)

a queue where each element in the queue has a priority when new elements are added into the queue, they are inserted ahead of those with a lower priority and behind those with equal priority.

#24
Front (Question)

what is a dynamic data structure?

Back (Answer)

a data structure where the size can change at any time