1/8
Prelim Topic
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Stack
A stack is a way to group things together by placing one thing on top of another and then removing things one at a time from the top of the stack.
Stack
In computer science, a stack is a Last-in, First-Out (L I F O) abstract data type and data structure. A stack can have any abstract data type as an element but is characterized by only two fundamental operations: push and pop.
push()
(Basic Operations on Stack)
To insert an element into the stack
pop()
(Basic Operations on Stack)
To remove an element from the stack
top()
(Basic Operations on Stack)
Returns the top element of the stack
isEmpty()
(Basic Operations on Stack)
returns true if the stack is empty, if not, false
Size()
(Basic Operations on Stack)
Returns the size of the stack
peek()
(Basic Operations on Stack)
Is a method that looks at the item at the top of the stack
search()
(Basic Operations on Stack)
Is a method that returns the position (in number) of an item from the top of a stack