Lesson 28/04/2020 Stacks and Queues Flashcards
What does LIFO mean and is it used by a stack of queue
Last In First Out, and is used by stacks
What does FIFO mean and is it used by a stack of queue
First In First Out
what is pointer used for (
a pointer is used to to know when a item joins or leaves a queue or stack
What does push, pop and peek mean in a stack
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
What are the steps for insertion into a stack
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
What are the steps for deleting items in a stack
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
in stacks are more important items at the top or bottom
important items are moved to the top