0% found this document useful (0 votes)
2 views

ADT in DSA-1

A data structure is a method for organizing and storing data efficiently in a computer, which aids in creating algorithms and managing data. It involves concepts like abstraction and encapsulation, where abstraction hides internal details and encapsulation combines data with functions. The document also distinguishes between abstract data types (ADT) and data structures, using examples like stacks implemented through arrays or linked lists.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

ADT in DSA-1

A data structure is a method for organizing and storing data efficiently in a computer, which aids in creating algorithms and managing data. It involves concepts like abstraction and encapsulation, where abstraction hides internal details and encapsulation combines data with functions. The document also distinguishes between abstract data types (ADT) and data structures, using examples like stacks implemented through arrays or linked lists.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

What is Data Structure?

A data structure is a way of organizing and storing data in a computer so that it


can be accessed and used efficiently. It refers to the logical or mathematical
representation of data, as well as the implementation in a computer program.

The following are the advantages of using the data structure:

o These are the essential ingredients used for creating fast and powerful
algorithms.
o They help us to manage and organize the data.
o Data structures make the code cleaner and easier to understand.

Before knowing about the abstract data type model, we should know about
abstraction and encapsulation.

Abstraction: It is a technique of hiding the internal details from the user and
only showing the necessary details to the user.

Encapsulation: It is a technique of combining the data and the member


function in a single unit is known as encapsulation
ADTs vs Data Structures"
• ADT is a concept, data structures are the implementation.
• Example:
o ADT: Stack
o Data Structures: Array-based stack, linked list-based stack.
Let's understand the abstract data type with a real-world example.

If we consider the smartphone. We look at the high specifications of the


smartphone, such as:

o 8 GB RAM
o Snapdragon 895ghz processor
o 6.5 inch LED screen
o Dual camera
o Android 14
The above specifications of the smartphone are the data, and we can also
perform the following operations on the smartphone:

o call(): We can call through the smartphone.


o text(): We can text a message.
o photo(): We can click a photo.
o video(): We can also make a video.
The smartphone is an entity whose data or specifications and operations are
given above. The abstract/logical view and operations are the abstract or logical
views of a smartphone.
Implement Stack Operations using Array:

You might also like