Save
A-level Computer Science
School Notes
Stacks and Queues
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Ana Saker
Visit profile
Cards (27)
What is a stack in data structures?
A
data
structure
for
storing
data
View source
What does LIFO stand for in the context of stacks?
Last In First Out
View source
What happens when you pop an item from a stack?
You
remove
the
last
item
added
View source
How is a stack implemented?
Using
one
pointer
View source
What are three uses of stacks?
Reversing
data
,
storing
return addresses
,
CPU
registers
View source
What are the contents of a stack after the following operations: Push A, Push B, Push C, Pop?
Stack Contents:
AB
View source
What is the difference between a stack and a queue?
Stack:
LIFO
(
Last
In
First
Out
)
Queue:
FIFO
(
First
In
First
Out
)
View source
What is a queue in data structures?
A
data
structure
for
storing
data
View source
What does FIFO stand for in the context of queues?
First In First Out
View source
What happens when you pop an item from a queue?
You
remove
the
first
item
added
View source
How is a queue implemented?
Using
two
pointers
View source
What are two common uses of queues?
Buffers
for
data processing
and
keyboard input
View source
What are the steps in the Push function for a stack?
Check for
stack
overflow
Increment
pointer
Add
item
to
stack
View source
What are the steps in the Pop function for a stack?
Check
for
underflow error
Return
item
at
pointer
Decrement
pointer
View source
What are the steps in the PushQ function for a queue?
Check
for
queue overflow
Increment
back pointer
Add
item
to
queue
View source
What are the steps in the PopQ function for a queue?
Check
for
queue empty error
Return
item
at
front pointer
Increment
front
pointer
View source
How can an array implement a queue?
Head pointer
and
tail pointer
Tail
pointer
increments
on
enqueue
Head
pointer
increments
on
dequeue
View source
What is a circular queue?
A
queue
that
wraps
around
in
memory
Resets
pointer
to
start
when
reaching
end
View source
What are the steps in the Push function for a circular queue?
Check
for
queue overflow
Increment
back pointer
Reset
back
pointer
if at
max
View source
What are the steps in the Pop function for a circular queue?
Check
for
queue
empty
error
Return
item
at
front pointer
Increment
front
pointer
and
reset
if at
max
View source
How does a circular queue solve the problem of memory migration?
It wraps around to the start of memory
View source
What error does the Push function check for in a stack?
Stack Overflow
error
View source
What error does the Pop function check for in a stack?
Underflow error
View source
What error does the PushQ function check for in a queue?
Queue Overflow error
View source
What error does the PopQ function check for in a queue?
Queue Empty
error
View source
What
happens if the back pointer reaches the maximum pointer in a circular queue?
It resets to the
start of memory
View source
What happens if the front pointer equals the back pointer in a queue?
It
indicates
a
queue
empty
error
View source