Abstract Data Type in Data Structure

Learn via video course
FREE
View all courses
DSA Problem Solving for Interviews using Java
DSA Problem Solving for Interviews using Java
by Jitender Punia
1000
4.9
Start Learning
DSA Problem Solving for Interviews using Java
DSA Problem Solving for Interviews using Java
by Jitender Punia
1000
4.9
Start Learning
Topics Covered

Overview

A data type defines the type of data structure. A data type can be categorized into a primitive data type (for example integer, float, double etc.) or an abstract data type (for example list, stack, queue etc.). In this article, we will discuss about Abstract Data Types (ADT).




Takeaways

Abstract data type in data structure type allows reusability of a code i.e. it makes it convenient for a programmer to write a shorter code.

What is Abstract Data Type in Data Structure?

An Abstract Data Type in data structure is a kind of a data type whose behavior is defined with the help of some attributes and some functions. Generally, we write these attributes and functions inside a class or a structure so that we can use an object of the class to use that particular abstract data type.

Examples of Abstract Data Type in Data Structure are list, stack, queue etc.

Abstract Data Type Model

Abstract data type model

List ADT

Lists are linear data structures in which data is stored in a non - continuous fashion. List consists of data storage boxes called 'nodes'. These nodes are linked to each other i.e. each node consists of the address of some other block. In this way, all the nodes are connected to each other through these links. You can read more about lists in this article: Linked List Data Structure.

List ADT

Given below are some of the important operations that are defined in List ADT.

Stack ADT

Stack is a linear data structure in which data can be only accessed from its top. It only has two operations i.e. push (used to insert data to the stack top) and pop (used to remove data from the stack top).

You can read more about stack in this article: Stack Data Structure.

Stack ADT

Given below are some of the important operations that are defined in Stack ADT

Queue ADT

Queue is a linear data structure in which data can be accessed from both of its ends i.e. front and rear. It only has two operations i.e. push (used to insert data to the rear of the queue) and pop (used to remove data from the front of the queue).

You can read more about queues in this article: Queue Data Structure.

Queue ADT

Given below are some of the important operations that are defined in Queue ADT.

Abstract Data Type Example

Let us understand an abstract data type with the help of a real world example.

We all know what Alexa is and what actions we can perform using Alexa. Below is an abstract data type written for some of the functions of alexa.

Advantages of Abstract Data Type

  1. Abstract data type in data structure makes it very easy for us to use the complex data structures along with their complex functions. It follows an object - oriented programming paradigm.
  2. By using abstract data types, we can also customize any data structure depending on how we plan to use that particular data structure.
  3. Abstract data type in data structure follows the concept of reusability of a code. This means that we don't have to write a particular piece of code again and again. We can just create an abstract data type and we can use it by simply calling the functions present in it.

Take your C++ programming skills to new heights with our Data Structures in C++ Course. Don't miss out!

Conclusion

  1. An abstract data type in data structure is a kind of a data type whose behavior is defined with the help of some attributes and some functions.
  2. An abstract data type in data structure can be that of a list data structure, stack data structure and a queue data structure. Several valid operations on a particular data structure are defined in the abstract data type.
  3. Abstract data types in data structure follow an object - oriented paradigm.