1 Intro
1 Intro
1 Intro
Binary form
Movies Images
Maps Music
Abstraction makes the logical view of a data type important than it’s physical implementation
complexities.
int, float, Account, Point, Rectangle, 2D array
The advantages of using the ADT approach:
Implementation of ADT can be changed without affecting those method that use the ADT
11 Saba Anwar, Computer Science Department- CIIT Lahore 15/09/2024
Abstract Data Type (ADT)
Abstraction has made the use of data structures more easy with concept of Abstract Data Type (ADT).
ADT is a data type whose internal implementation is hidden from user. In other words an ADT specifies set of
data values and associated operations independent of any particular implementation.
Stack ADT
Values: would follow last in first out order
Operations:
Push(E): will add element E on top of existing elements
Pop(): will remove top element
Peek(): will return top element, without removing
Abstraction:
This ADT does not explain how it would be implemented? as a class, struct, simple structured programming, using array or linked list, would it work for integers? Or
strings?
There is no assumption about types and there is no logic given for operations.
User just needs to know what a stack does? what push and pop will do?
Now when a programming language implements an ADT, it adopts a certain implementation logic which can vary from
other languages, but their implementation does not change the definition of ADT
12 Saba Anwar, Computer Science Department- CIIT Lahore 15/09/2024
Data Structure and ADT
ADT is the logical view
Stack ADT does not specify anything about implementation. It just describes the
expected behaviors.
Data structure is the physical implementation
To implement Stack ADT you have to choose your container, and describe your
algorithms for operations which greatly depends upon your choice.
In OO world interface and classes serve as an encapsulating units which can
hide the implementation from user. User is only concerned about what methods
are available and what they do?
Application:
Hashtables, Adjacency Matrices, Stacks, Queues