Is Stack an ADT or Data Structure?


Larry Thompson

Is Stack an ADT or Data Structure?

When it comes to data structures and abstract data types (ADTs), the stack is a fundamental concept that is often discussed. But is it considered an ADT or a data structure? Let’s dive into this topic and explore the characteristics of a stack to understand its categorization.

Stack Overview

In simple terms, a stack is an ordered collection of elements where the insertion and removal of items follow a specific order called “last in, first out” (LIFO). This means that the last item inserted into the stack will be the first one to be removed.

ADT vs. Data Structure

To clarify the distinction between ADTs and data structures, we should understand their definitions:

Abstract Data Type (ADT):

  • An ADT is a high-level description of how a data type behaves.
  • It defines the operations that can be performed on that type.
  • The implementation details are hidden from the user, focusing solely on functionality.
  • The ADT serves as a blueprint for creating concrete implementations.

Data Structure:

  • A data structure refers to the concrete implementation of an ADT.
  • It involves representing elements in memory and defining algorithms for accessing and manipulating those elements.
  • Data structures provide efficiency considerations based on space complexity and time complexity.

The Stack as an ADT

A stack fits perfectly into the definition of an abstract data type. It specifies the behavior of operations that can be performed on a stack without concerning itself with any specific implementation details. The core operations defined for a stack ADT are:

  • Push: Adds an element to the top of the stack.
  • Pop: Removes and returns the topmost element from the stack.
  • Peek (Top): Returns the topmost element without removing it.
  • isEmpty: Checks if the stack is empty or not.

The ADT definition does not dictate how these operations are implemented or how elements are stored in memory. It only focuses on what can be done with a stack, leaving room for multiple concrete implementations.

The Stack as a Data Structure

In terms of data structures, a stack can be implemented using various approaches such as arrays or linked lists. These concrete implementations define how elements are stored in memory and how the stack operations are carried out efficiently.

In an array-based implementation, a fixed-size array is used to hold the elements of the stack. The top of the stack is represented by an index that points to the last inserted element. The push operation increments this index, while pop decrements it.

An alternative implementation uses a linked list, where each node holds an element and a reference to the next node. The head of the linked list represents the top of the stack. Pushing and popping elements involve updating this reference accordingly.


To sum up, a stack is both an abstract data type (ADT) and a data structure. It serves as an ADT by defining its behavior and operations without specifying any implementation details. At the same time, it can be implemented using different data structures like arrays or linked lists, allowing for efficient manipulation of elements in memory.

The understanding of a stack as both an ADT and a data structure is crucial in computer science and programming, as it provides a foundation for solving various problems efficiently and effectively.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy