Pages

Need Of data Structure



Need of  Data Structures
Data Structure is a way of representing and organizing data in such a way that we can perform operations on data effectively. Data Structures is about representation of  data elements in association, for better organization and storage.
For example, we have data student’s name "ABC" and Roll No 25. Here "ABC" is of character data type and 25 is of integer data type.
We can organize this data as a record of student. Now we can collect and store Students records in a file or database as a data structure. For example: "DEF" 34, "XYZ" 43, "HIJ" 70.
Data Structures are structures programmed to store ordered data, so that various operations can be performed on it easily. It represents the how the data is to be organized in memory. It is designed and implemented in such a way that it reduces the complexity of performing operations and increases the efficiency and result.

Basic types of Data Structures

Data structure like Integer, Float, Boolean, Char etc, are storing data. They are known as Primitive Data Structures, which store similar kind of data together.
Then to combine these different Data Structures together to perform operation or to maintain as a record we also have some complex data structures, which are used to store large and connected data which are called as Abstract Data Structure are :
·         Array
·         Stack
·         Queue
·         Linked List
·         Trees
·         Graph
All these data structures allow us to perform different operations on data. We select these data structures based on which type of operation is required. 



The data structures can also be classified on the basis of the following characteristics:
Characterstic
Description
Linear/ Sequential
In this the data items are arranged in a linear/ sequential Manner . Like Array
Ex. A[10] = { 1,2,3.4,5,6,7,8,9,10}
Non-Linear
In this the data items are not in sequence. Like Tree, Graph
 

Homogeneous

In this all the elements are of same type. Like: Array

Ex. int A[10] = { 1,2,3.4,5,6,7,8,9,10} all are of type integer
       char B[10] = {a, b,c,d,e,f,g,h,i, k} all are of type character
Non-Homogeneous
 In this the elements may be same or it may have different data type. Like Structures

Structure student
{
    int roll_no;
    char name[10];
 }
  
Static
Static data structures are those whose sizes and structures associated memory locations are fixed, at compile time.
 Example: Array a[10] = { 1,2,3.4,5,6,7,8,9,10}

1
2
3
4
5
6
7
8
9
10
100
102
104
106
108
110
112
114
116
118

Memory blocks will get occupied for array like this in a sequential manner at a one place. As integer will occupy 12 bytes to store the data. The next line indicates the addresses where it is allocated.  
Dynamic

Dynamic structures are those which create data structure dynamically means run time. As it is getting the memory at run time for the data structure it will be in random order

. Example: Linked List created using pointers




No comments:

Post a Comment