What is Data Structure?
Data Structure is a mathematical or logical way of organizing data in memory. Data Structure does not represent only data in memory but it also represents the relationship among the data that is stored in memory.
There are various operations that can be performed on Data Structure:
| (1) Traversal (2) Insertion (3) Deletion (4) Searching (5) Sorting (6) Merging |
Data Structure allows us to manipulate data by specifying a set of values, set of operations that can be performed on set of values and set of rules that needs to be followed while performing operations.
Types of Data Structure
Basically Data Structure can be classified into two categories:
(1) Primitive Data Structure
(2) Non Primitive Data Structure
Primitive Data Structure
"The Data Structure which is directly operated by machine level instruction is known as Primitive Data Structure."
All primary (built in) data types are known as Primitive data Structure.
Following are Primitive Data Structure:
| (1) Integer |
Integer Data Structure is used to represent numbers without decimal points.
|
| (2) Floating Point |
Float Data Structure is used to represent numbers having decimal point. |
| (3) Character |
Character is used to represent single character enclosed between single inverted comma. |
Non Primitive Data Structure
"The Data Structure which is not directly operated by machine level instruction is known as Non Primitive Data Structure."
Non Primitive Data Structure is derived from Primitive Data Structure.
Non Primitive Data Structure are classified into two categories:
(1) Linier Data Structure
(2) Non Linier Data Structure
Linier Data Structure
"The Data Structure in which elements are arranged such that we can process them in linier fashion (sequentially) is called linier data structure."
Following are Examples of Linier Data Structure:
| (1) Array |
|
Array is a collection of variables of same data type that share common name. Array is an ordered set which consist of fixed number of elements. In array memory is allocated sequentially to each element. So it is also known as sequential list. |
| (2) Stack |
Stack is a linier Data Structure in which insertion and deletion operation are performed at same end. |
| (3) Queue |
Queue is a linier Data Structure in which insertion operation is performed at one end called Rear end and deletion operation is performed at another end called front end. |
| (4) Linked List |
Linked list is an ordered set which consist of variable number of elements. In Linked list elements are logically adjacent to each other but they are physically not adjacent. It means elements of linked list are not sequentially stored in memory. |
Non Linier Data Structure
"The Data Structure in which elements are arranged such that we can not process them in linier fashion (sequentially) is called Non-Linier data structure."
Non Linier Data Structures are useful to represent more complex relationships as compared to Linier Data Structures.
Following are Examples of Non-Linier Data Structure:
| (1) Tree |
A tree is a collection of one or more nodes such that:
|
| (2) Graph |
|
A Graph is a collection of nodes and edges which is used to represent relationship between pair of nodes. A graph G consists of set of nodes and set of edges and a mapping from the set of edges to a set of pairs of nodes. |