Terms in this set (5)
Describe a stack?
- A stack is much like a stack of pancakes
- LIFO, Last in first out
- List based data structure
- A stack of objects, putting elements on top and have easy access to move or access to the top element
- stacks can be very useful when you only care about the . most recent elements, or the order in which you see and save the elements, actually matters
Name methods commonly performed on a stack data stucture.
- this will put an element on the top of the stack
- this will remove the most recent item placed on the stack
Linked List and stacks?
You could use a linked list to implement a stack, you keep track of the front of a single linked list and just keep adding elements as the tail
put an item on the stack
Remove the most recent item place onto the stack