The Stack Abstract Data Type
Get an overview of stack operations and the data type you can use to implement a stack.
We'll cover the following
Stack ADT
The stack ADT is defined as a class that follows the LIFO principle for its elements. The stack should support the following operations:
Push()
: Adds a single element at the top of the stackPop()
: Removes a single element from the top of the stack.Top()
: Reads the value of the top element of the stack (does not remove it).isEmpty()
: Returns1
if the stack is empty.Size()
: Returns the number of elements in the stack.
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy