Data Structure and Algorithms
Defination of Data Structure
Data structure and algorithms are most important part of programming. Understanding of algorithms and data stures plays a vital role in effiecient programming. All programming languages support different types of data structures. Data structure and algorithms are used collectively for the following purposes.
- Data storage
- Data retrival
- Data manipulation
Basically data structure and algorithms are two different terms.
1.Data Structures
The term data structure refers to the memory locations that are managed in some special order. These all data structures has some special characteristics. These data structures use different algorithms for data retrival and manipulation.
2. Algorithm
The term algorithm refers to the procedures (Instructions) that are written in some languages to implement the data structures. These algorithms defines the the operations of data structures.
Types of Data Structures
There are two major types of data structures used in programming languages for data manipulation. These types are as follows.
1. Linear Data Structure
A type of data structure in which elements or data is stored in sequence or order is called linear data structure. In linear data struture data items are stored one after another in memory. Linear data structures are fast in retrival in sequence. These data structures performance is slow while searching and sorthing data items. Some examples of linear data structures are as follows.
2. Non Linear Data Structure
In non-linear data structures data items are stored in some hierarchical style. The items/data is not stored in sequence. There data items are normally called as nodes. Data searching and retrival is fast in non-linear data structures. Non-linear data structures are memory efficient and provide a consistant tome complexity for small as well as for large data. Some important examples of non-linear data structures are as follows.
-
Graph
-
Tree
-
Map
Difference between Linear and Non-linear Data Structure
Some important and prominent difference between linear and non-linear data structures are as follows.
Sr. | Linear Data Structure | Non-linear Data Structure |
---|---|---|
1 | Linear data structures store data in some sequence | Non-linear data structures store data in some inverted tree like struture |
2 | Time complexity increases as the size of data extremely goes large | Time complexity remains same for small and large size of data. |
3 | Linear data strutures are not preferable for better memory utilization. | Non-linear data strutures are best choice for better memory utilization |
4 | Linear data structures are easy to implement. | Non linear data strutures require professional expertise for implementation. |
5 | Commonly used linear data strutures are arrays, queue and stacks. | Commonly used non-linear data structures are tree and graphs. |