stacks Flashcards
what is a stack
a stack is a data structure that is essential for the operation of a computer
What is meant by the acronym LIFO and how does it relate to a stack data structure?
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
Describe a computer related practical example of where a stack data structure might be used.
when you use a back button in your web browser , you will be taken back through the previous pages that you looked at
operations of stack push (item)
adds a new item to the top of the stack
pop()
removes and returns the top item from the stack
peek()
removes the top item from the stack but does not remove it
isEmpty()
tests to see whether the stack is empty ,and returns a boolean value
isFull
tests to see whether the stack is full ,and returns a boolean value