Stacks Flashcards
1
Q
Definition
A
Based on an array but just have one pointer - a top pointer
2
Q
Type of data structure
A
First in, last out (FILO)
3
Q
Example to remember the type of data structure
A
Students placing books down for a teacher to mark.
4
Q
Operations that can be performed.
A
Push (add an item) Pop (remove an item) Peek Isfull Isempty
5
Q
What is the peek function
A
Returns the value at the top of the stack without actually removing it.
6
Q
The pop operation can be used to
A
Assign variables and constants.
e.g. operation:
x
7
Q
Peek operation can be used to
A
Assign variables and constants.
8
Q
Stack overflow definition
A
When there are no available spaces left on the stack
9
Q
Stack underflow definition
A
When you try to use the pop command on an empty stack.