Q.1. What do you mean by Data Structure ? Describe different types of Data Structure ?
Ans. Data Structure : A data structure is a class of data that can be characterised by its organization and the operations that are defined on it. Hence
Data Structures = Organised data + Allowed operations
In other words, the organised collection of data is called data structure.
Let us now formally define a Data Structure.
A data structure is a set of values along with the set of operations permitted on them. It is also required to specify the semantics of the operations permitted on the data values, and this is done by using a set of axioms, which describes how these operations work, and therefore a data structure is made of
- A set of data values
- A set of functions specifying the operations permitted on the data values.
- A set of axioms describing how these operations work.
- Primitive and Non-Primitive data structure : The data structure that are atomic (indivisible) are called primitive. Example are integer, real, boolean and characters.
The data structures that are not atomic are called non primitive or composite. Example are records, array and string.
- Linear and Non-Linear data structure : In a linear data structure, the data items are arranged in a linear sequence. Example is array.
- Homogeneous and Non-Homogeneous data structure : In homogeneous structures, all the elements are of same type. Example is arrays.
- Static and dynamic data structures : Static structures are ones whose size and structures, associated memory location are fixed at compile time.
Dynamic structures are ones which expand or shrink as required during the program execution and there associate memory location change.