Stacks Flashcards
What is a stack?
An abstract data type that holds an ordered linear sequence of items
What structure does a stack follow?
LIFO (Last in fist out)
What does push(data) do?
Adds an element to the top of a stack
What does pop() do?
Removes an element from the top of the stack
What does peek() do?
Returns a copy of the top element of a stack without removing it
What does is_empty do?
Checks whether a stack is empty
What does is_full do?
Checks whether a stack is at maximum capacity when stored is static
What are stacks main operations?
pushing items onto and popping items off the stack
What causes a stack overflow?
Continuously adding items to an statically implemented array
What is needed to implement dynamic stacks?
Linked lists, additional tracking variables