121 Week 8 - Stack and Linked Lists Flashcards
Stack
An abstract data type which holds a collection of items in the order in which they were added. It is a Last in First out data type meaning items are added to and removed from the top of the stack.
Stack functions
Push - add an item to the top of the stack
pop - remove the item on top of the stack and return its value.
Empty - return true if the stack has no items, else return false
Underflow
Trying to pop from an empty stack
Overflow
In bounded stacks, trying to push an item when the stack is full
Applications of a stack
Call stack for program execution
Syntax and semantics of programming languages
Depth first searching algorithms
List
An abstract data type that stores a set of items in a linear order. It cannot have duplicates
Singly linked list
A list where elements contain a value and a pointer to the next item in the list
Doubly linked list
A list where elements contain a value and a pointer to the next item in the list and previous item in the list.