Lesson 4: Stacks Flashcards
data structure in which all insertions and deletions are restricted to one end, called the top
Stacks
Is Stack LIFO (last-in, first-out) or FIFO (first-in, first-out)?
LIFO
Basic Stack Operations (clue: PPS)
Push
Pop
Stack Top (TopMost)
[Basic Stack Operations] Used to insert a new element at the top of the stack
Push
[Basic Stack Operations] Problem in Push
Overflow
[Basic Stack Operations] Removes the element at the top of the stack and returns the data to the calling module
Pop
[Basic Stack Operations] Problem with Pop
Underflow
[Basic Stack Operations] Returns the data at the top of the stack without deleting the data from the stack.
Stack Top (TopMost)
[Basic Stack Operations] Problem with Stack Top (TopMost)
Underflow
Two Structures to Implement Stack (clue: HD)
Head
Data node
[Two Structures to Implement Stack] Contains metadata
Head
[Two Structures to Implement Stack] Head requires only two attributes, which are? (clue: TC)
Top pointer
Count of the number of elements in the deck
Stack Algorithms (clue: CPPSEFSD)
Create stack
Push stack
Pop stack
Stack top
Empty stack
Full stack
Stack count
Destroy stack
[Stack Algorithms] sends the data at the top of the stack back to the calling module without deleting the top node. It allows the user to see what will be deleted when the stack is popped
Stack top algorithm
[Stack Algorithms] Provided to implement the structured programming concept of data hiding
Empty Stack