Glossary: Data Structures and Algorithms
Push, pop, peek
Also written: push, pop, peek
The three stack operations: push adds an item to the top, pop removes and returns the top item, and peek looks at the top without removing it. All are O(1).
Glossary: Data Structures and Algorithms
Also written: push, pop, peek
The three stack operations: push adds an item to the top, pop removes and returns the top item, and peek looks at the top without removing it. All are O(1).