Lesson 28/04/2020 Stacks and Queues Flashcards

1
Q

What does LIFO mean and is it used by a stack of queue

A

Last In First Out, and is used by stacks

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

What does FIFO mean and is it used by a stack of queue

A

First In First Out

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

what is pointer used for (

A

a pointer is used to to know when a item joins or leaves a queue or stack

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

What does push, pop and peek mean in a stack

A

push: add a item to the stack
pop: to delete a item in the stack
peek/top: look at the top item but don’t move it

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

What are the steps for insertion into a stack

A

1) Check to see if stack is full
2) if the stack is full report a error and stop the program
3) increment the stack pointer
4) insert new data into item location pointed to by back pointer

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

What are the steps for deleting items in a stack

A

1) Check to see if stack is empty
2) if the stack is empty report a error and stop the program
3) copy data item in in location pointed to by front pointer
4) increment the front pointer and stop

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

in stacks are more important items at the top or bottom

A

important items are moved to the top

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