Hello geeks! today we are going to differentiate between datatype and abstract datatype.This is very confusing among the students how to differentiate datatype and abstract datatype.But after this blog are totally able to differentiate both very easily.so without wasting time lets start.
-DATATYPE-
A datatype defines a domain of allowed values and the operations that can be performed on those values.For example in C language,int datatype can take the values in the specified range and operations that can be performed are addition,subtraction,multiplication,division,bitwise operations etc.Similarly the datatype float can take values in a particular range and operations allowed are addition,subtraction,multiplication,division etc (% operation and bitwise operation are not allowed).These are built-in datatypes or primitive datatypes and the values and operations for them are defined in the language.
If an application needs to use a datatype other than the primitive datatypes of the language,i.e. a datatype for which values and operations are not defined in the language itself,then it is duty of the programmer to specify the values and instructions for that datatype and implement it.For example there is no built in type for dates in C language,and if we need to process dates then we have to define and implement a datatype for date.
-ABSTRACT DATATYPE-
Abstract datatype is a mathematical model or concept that defines a datatype logically.It specifies a set of data and collection of operations that can be performed on that data.The definition of ADT only mentions what operations are to be performed bot not how these operations will be implemented.It does not specify how data will be organized in memory and what algorithms will be used for implementing the operations.It is called "abstract" because it gives an implementation independent view.The process of providing only the essentials and hiding the details is known as abstractions.
The user of a data type need not know the data type is implemented,for example we have been using int,float,char datatypes only with the knowledge of values that they can take and operations taht can be performed on them without any idea of how these types are implemented.So a user only needs to know what a datatype can do but not how it will do it.We can think of ADT as a black box which hides the inner structure and design of the datatype.Now we'll define three ADTs namely List ADT,Stack ADT and Queue ADT.
No comments:
Post a Comment