stacks Flashcards

1
Q

what is a stack

A

a stack is a data structure that is essential for the operation of a computer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is meant by the acronym LIFO and how does it relate to a stack data structure?

A

a stack is known as at a last in first out data structure , last item to be pushed onto the stack must be the first item to be popped off

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe a computer related practical example of where a stack data structure might be used.

A

when you use a back button in your web browser , you will be taken back through the previous pages that you looked at

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

operations of stack push (item)

A

adds a new item to the top of the stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

pop()

A

removes and returns the top item from the stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

peek()

A

removes the top item from the stack but does not remove it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

isEmpty()

A

tests to see whether the stack is empty ,and returns a boolean value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

isFull

A

tests to see whether the stack is full ,and returns a boolean value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly