Stack

Introduction to the data type stack. The stack is an abstract data type of defined operations. In this lesson, we will learn about the stack and its applications. We will also do some programming exercises to help you understand the concept through practice.

We'll cover the following

The stack is an abstract data type with the following operations:

  • Push(value): Add a value into the underlying collection.
  • Pop(): Remove the most recently pushed value from the collection.
  • Top(): Get the most recent key without removing it from the collection.

    All the above operations are completed in O(1) time.

  • Level up your interview prep. Join Educative to access 70+ hands-on prep courses.