Abstract Data Type ( ADT ) and Abstraction

Abstraction is the process of hiding many information and showing only the information of greater importance. Before writing the program first thing we have is problem. However, the problems that we asked to solve in real life are complicated. We need to list out most fundamental parts and describe these part in simple language. This overall process is called abstraction.

Hiding all the information from outside world and focus on 

the info of greater importance is abstraction.

Through abstraction we can generate the model of the problem. That model includes the data and operations that are required to access and modify data. For example consider a program that manages the student records. There are many properties we could think about a student such as name, id, date of birth, major, email, phone, address etc. But all these properties are not necessary to solve the problem so we only consider name and id and the operations are add, search and display. This concept is the abstraction.

Now we have to think about how these student record will be stored in memory and how these operation will be implemented. Here comes the Abstract Data Type (ADT).

Abstract Data Types (ADT)

A useful tool for specifying the logical properties of a data type is the abstract data type. A data type is a collection of values and a set of operations on those values. That collection and those operations form a mathematical construct that may be implemented using a particular hardware or software data structure. The term ADT refers to the basic mathematical concept that defines the data types.

An ADT is the mathematical model of any data structure:
it provides the definition of type of data, operations 
on data and parameters need to be pass.

An abstract data type is a mathematical model of a data structure that specifies the type of data stored, the operations supported on them and the types of parameter of the operations. In defining ADT, we are not concerned with space and time efficiency. Those are implementation issues. In fact, the definition of ADT is not concerned with implementation details at all. An ADT specifies what each operation does, but not how it does. By specifying the mathematical and logical properties of a data type or structure, the ADT is useful guideline to implementer and a useful tool to programmers who wish to use data type correctly.

ADT is an abstract concept which focus on "what" not on "how".

An ADT consists of two parts: a value definition and an operator definition. The value definition defines the collection of values for the ADT and consists of two parts; a definition clause and a condition clause. Each operator is defined as an abstract function with three parts; a header, the optional precondition and the post conditions.  

ADT = DATA + OPERATIONS

The steps of building ADT to data structures are:
  • Understand and clarify the nature of the target information unit.
  • Identify and determine which data objects and operation to include in the models.
  • Express this property somewhat formally so that it can be understood and communicate well.
  • Translate this formal specification into proper language.

Examples of ADT includes list, stack, queue, tree, graph etc.

For stack as an ADT; 
we define type of parameter and the operations are:
push() - Insert new elements
pop() - delete element
isFull() - check whether stack is full or not
isEmpty() - check whether stack is empty or not

Here we do not focus on the implementation part only on the modeling and defining part.





Comments

Popular posts from this blog

Data Structures and Algorithms : Introduction, Type and Uses

What is Algorithm? and its types