notebook/notes/abstract-data-types/stacks.md

85 lines
2.4 KiB
Markdown
Raw Normal View History

2024-05-12 15:19:27 +00:00
---
title: Stacks
TARGET DECK: Obsidian::STEM
FILE TAGS: adt::stack
tags:
- adt
---
## Overview
%%ANKI
Basic
Which abstract data type is most strongly associated with LIFO?
Back: The stack.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715461853887-->
END%%
%%ANKI
Basic
What does LIFO stand for?
Back: **L**ast **i**n, **f**irst **o**ut.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715461853892-->
END%%
%%ANKI
Basic
What is a stack's insertion method typically called?
Back: `PUSH`
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715461853897-->
END%%
%%ANKI
Basic
What is a stack's deletion method typically called?
Back: `POP`
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715461853903-->
END%%
%%ANKI
Basic
Which element of a stack is deleted on `POP`?
Back: The top element.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715461853908-->
END%%
%%ANKI
Basic
What does it mean for a stack to overflow?
Back: A `PUSH` was requested but the underlying data structure is full.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715461853914-->
END%%
%%ANKI
Basic
What stack method can invoke an overflow?
Back: `PUSH`
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715461853919-->
END%%
%%ANKI
Basic
What does it mean for a stack to underflow?
Back: A `POP` was requested but no elements exist in the stack.
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715461853925-->
END%%
%%ANKI
Basic
What stack method can invoke an underflow?
Back: `POP`
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
<!--ID: 1715461853930-->
END%%
## Bibliography
* Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).