Data Type is a particular kind of data item, as defined by the values it can take, the programming language used, or the operations that can be performed on it.

computer science

Description

1)     a) Define data type and abstract data type (ADT).

 

Data Type is a particular kind of data item, as defined by the values it can take, the programming language used, or the operations that can be performed on it. It is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data. Most programming languages support common data types of real, integer and Boolean. Abstract Data type (ADT) is a type (or class) for objects whose behaviour is defined by a set of value and a set of operations. An ADT can as well be defined as a mathematical model for data types, where a data type is defined by its behaviour from the point of view of a user of the data, specifically in terms of possible values, possible operations on data of this type, and the behaviour of these operations. So, the key difference is that a data type represents encapsulation, and ADT represents abstraction.

 

b) Give an example of an abstract data type.

      In Abstract Data Type (ADT) only behaviour is defined but not implementation. On the other hand, opposite of ADT is Concrete Data Type (CDT), which contains an implementation of ADT. The examples of ADT are Array, List, Map, Queue, Set, Stack, Table, Tree, and Vector.

 

c) List five benefits of using ADTs, giving a short explanation of each.

 

i.    ADT is reusable, robust, and is based on principles of Object Oriented Programming (OOP) and Software Engineering (SE)

ii.   An ADT can be re-used at several places and it reduces coding efforts

iii.  Encapsulation ensures that data cannot be corrupted

iv.  Working of various integrated operation cannot be tampered with by the application program

v.   ADT ensures a robust data structure

 

 

 

2)     With the help of graph explain different asymptotic notations Give example for each.

 

Asymptotic Notations are the expressions that are used to represent the complexity of an algorithm. There are three types of analysis that are performed on a particular algorithm. Asymptotic notations are used to make meaningful statements about the efficiency of the algorithm. Asymptotic notation helps us to make approximate but meaningful assumption about the time and the space complexity.

 

i.      Best Case: In which the performance of an algorithm for the input is an analysed, for which the algorithm takes less time or space.

 

 ii.       Worst Case: In which performance of an algorithm for the input is analysed, for which the algorithm takes long time or space.

Instruction Files

Related Questions in computer science category