Explanation of Abstract Data Types with Diagram and Example

In computer science, abstract Data types (ADT) is a class (or type) for objects whose behavior of each function is defined by a set of values and a set of operations.

In another way, you can say that abstract data types (ADT) are a mathematical model for data types where the data types defined by its semantics(behavior) from the pint of view of a user of the data.

therefore, in case of possible values, possible operations on data oof these types and the behavior of the operations.

abstract data types

ADT only mentions which operation is to be performed but not this operation how will be implemented.

how data will be organized in the memory and what algorithms will be used for operation it does not specify in ADT.

it is called abstract because it gives an independent-implementation view.

therefore only the essentials and hiding details providing process are known as an abstraction.


abstract data types

A data structure is an implementation for an ADT (Abstract Data Types).

An object is an instance of a class, during the execution of a computer program is created and takes up storage.

Each operation associated with the ADT is implemented by a method or member function.

furthermore, The variables that define the space required by a data item are referred to as data members.

In an object-oriented language, abstract Data types and its implementation together make up a class.

The term DS (data structure) often refers to data stored in the main memory such as computers.

therefore, The related term file structure often refers to the organization of data on peripheral storage,

such as a CD or disk drive.

In computer science the concept of abstraction is found, A big program is never written as a monolithic

piece of the program.

therefore, the program is broken down in smaller modules it’s called a procedure or function and every module is developed independently.

When the program is organized in a hierarchical as shown in the below program, therefore the main program utilizes services at the functions appearing at Level 1. similarly.

the function written at level 1 utilizes services of functions written at level 2.


the main program uses the services at the next level function without knowing their implementation

details, therefore, thus a level of abstraction is created.

you can say that when an abstraction is created at any level, our concern is limited to “how it is done”

and “what it can do”

Abstraction In Case Of Data

Abstraction for the primitive types (int, float, char) is provided by the compiler.
therefore, for example, we use integer type data and also perform various operation on them without knowing them:

(1) Representation
(2) How various operations are performed on them?

For Example:

Explanation: the meaning of the operation '+' is defined by the compiler and its implementation details remain hidden from the user.

Implementation details and how various operations are implemented remain hidden from the user, the user is only

concerned about, how to use these operations.

Abstract Data Types Concept

Let us consider the container it has one open-end and closed-end, through the open end.

we put any item and through this end. we get the item, as we using this container to store items

of the same type hence all the content stored in it will be the same.

abstract data types example

therefore, it supports homogeneous data in the same way stack stores, the data of the same type

item will be at the bottom which is inserted at first when stack or container is empty. item will be

at the top which will be inserted in the

last for example first item will be at the bottom and the last item will be at the top.

when we retrieve the items from it we will get the last item at first and first inserted an item at last.

therefore again when containers or stack is full we cannot store more items into it. As glass is full and

we want to store more water overflow occurs when the glass is empty we can not get water from it

i.e. underflow occurs.

Working Principle:-

Stack works on the LIFO principle, therefore means that last in first out i.e. we will get the last inserted item at first

while retrieving the item from the stack and in the last, we will get what we had inserted at first.

State Associated with Stack

therefore, the stack has two states associated with it 1) Overflow state 2) Underflow state
state associated with stack

Fig (b)is showing overflow state and fig (c) is showing underflow condition or state as container or stack has the

finite size we cannot store items more than its capacity. if we do overflow will take place as a result newly inserted as

well or previously-stored item either will be lost. if the container is empty we cannot get an item from it. this state is

called underflow.

The operation associated with the stack

operation associated with_stack

therefore either we can store items to stack or we can get them back the stack.

Hence inserting items to it is called push operation and retrieving them back is called pop operation.

Again when the stack is in overflow state we can not perform push operation and it underflow states we can not

perform the pop operation.

The relationship between data items, abstract data types, and data structures

As you can see in the given below Diagram Data types have both a logical form and a physical form. thus the definition of the data type in terms of an ADT (Abstract Data Types) is its logical form. therefore, the implementation of the data type as a data structure (DA) is its physical form.

Sometimes you might see the term redundant implementation, but the word redundant is concrete.
The given below figure illustrates this relationship between logical form and physical forms for data types.

When you implement an ADT (Abstract Data Types), therefore, you are dealing with the physical form of the associated data type. sometimes when you use an ADT elsewhere in your program, furthermore, you are concerned with the associated data type’s logical form.

Abstract Data types Relationship

The ADT (Abstract Data Types) defines the logical form of the data type. hence, the data structure (DA) implements the physical form of the data type.
Users of Abstract Data Types are typically programmers working in the same language such as the implementer of the ADT.
therefore, Typically, these programmers want to use the Abstract Data types as a component in another application.
The interface to an ADT is also commonly referred to as the Application Programmer Interface, or API, for the ADT.
thus The interface becomes a form of communication between the two programmers.