Introduction of Data Type Data Type n n

  • Slides: 10
Download presentation
Introduction of Data Type

Introduction of Data Type

Data Type n n Data type can be defined as a set of values

Data Type n n Data type can be defined as a set of values and set of operation on those values. If we are using a term object, then it is referred as the set of objects and set of operation on those objects which create and destroy the object. That means : data type is a set of objects and set of specified operation on those objects which create and destroy the instance of object. In a programming language, the variable data type is the set of values that it may assume.

Data Type n n The basic data type vary from one programming language to

Data Type n n The basic data type vary from one programming language to other. Data type basically falls into two broad categories simple or basic and composite data type. Data type Simple (Basic) Data type Composite Data type

Simple Data Type n n n It is made up of values that cannot

Simple Data Type n n n It is made up of values that cannot by further decomposed. In particular simple data types is considered to be the last level where further decomposition of values is not possible. In C language, such type of data types are int (integer), char (character), float (floating point)

Composite Data Type n n It is made of values which can be further

Composite Data Type n n It is made of values which can be further decomposed to from another level of values that belong to either simple data type or composite data type. Another category of data type is composite data type known as data structure. In this type, elements can be decomposed into next level that may either have simple data type or composite data type. In C language, array and structure belong to the category of data type.

Abstract Data Type n n n It is a data type having set of

Abstract Data Type n n n It is a data type having set of values and associated operations on those values in such as manner that the implementation part of hidden. In short: ADT is a set of values and set of associate operations that are precisely specified dependent of any particular implementation. ADT is also defined as a mathematical model which is user-defined type along with the set of operations that can be performed on that model.

Abstract Data Type n n More generally it has two parts: first part signifies

Abstract Data Type n n More generally it has two parts: first part signifies the way in which the components are related to each other and the second part signifies the operations that can be operated on the components of the abstract data type. Some examples of abstract data types: n List n Stack n queue

Abstract Data Type: List n n n n It is an abstract data type

Abstract Data Type: List n n n n It is an abstract data type which includes a finite set of items along with the following operations: Create: This operation creates a empty list Isempty: This operation to check whether the list is empty or not. Isfull: This operation to check whether the list is full or not. Length: This operation computes the length of the list. Insertion: This operation insert/add item in the list only when it is not full. Deletion: This operation delete/remove an item from the list only when list is not empty.

Abstract Data Type : Stack n n n n It is an abstract data

Abstract Data Type : Stack n n n n It is an abstract data type which includes a finite set of items along with the following operations: Create: This operation creates a empty stack Isempty: This operation to check whether the stack is empty or not. Isfull: This operation to check whether the stack is full or not. Length: This operation computes the length of the stack. Push: This operation insert/add item in the stack only when it is not full. Pop: This operation delete/remove an item from the stack only when list is not empty.

Abstract Data Type : Queue n n n n It is an abstract data

Abstract Data Type : Queue n n n n It is an abstract data type which includes a finite set of items along with the following operations: Create: This operation creates a empty queue Isempty: This operation to check whether the queue is empty or not. Isfull: This operation to check whether the queue is full or not. Length: This operation computes the length of the queue. Insertion: This operation insert/add item in the queue only when it is not full. Deletion: This operation delete/remove an item from the queue only when list is not empty.