Definition of Data structure:
- Data structures is a method of organising a huge amount of data adeptly so that any operation on that data becomes very easy.
Data structure can be implemented in 2 ways:
1.Abstract view
2.Implementation view
1.Abstract view :
.
2.Implementation view:
primitive data structures:
primitive data types means primary data types, which are already defined or can be represented by one word.
examples:
- int
- float
- char
- double
Non-primitive data structures:
Non-primitive data structures is also called derived data structures, it is derived from primary data structures. It can divide in to two types:
1. Linear data structures.
2.Non-Linear data structures.
example:
int a[10];
Here size is 10, so it can store up to 10 different values under the name of a (array name).
Linear data structures:
If a data structure arrange the data in continuous order, then it is called Linear data structure.
example:
- Arrays
- Linked list
- Stack
- Queue
Non-Linear data structure:
If a data structure arrange the data in random order, then it is called non-linear data structure.
example:
- Tree
- Graphs
- Heaps etc..
Arrays:
An array is a variable which can store multiple of values of same data type at a time.
example:
int a ,b;
Here a, b are variable name, and int is a data type.
suppose a=10; b=20;
Here each variable consists only one value and each variable consists 2 bytes.
Linked list:
Linked list is a linear data structure that contains a sequence of elements such that each element links to its next element in a continuous order. In linked list each element is called as "NODE".
Linked list : 1)Single linked list
2)Doubly linked list
3)Circular linked list
Single linked list:
Single linked list is a sequence of elements in which every element has link to its next element in the continuous order.
Graphical representation:
single linked list |
Doubly linked list:
Doubly linked list is a sequence of elements in which every element has link to its next element and to its previous element in the sequence.
Graphical representation:
Circular linked list:
Circular linked list is a sequence of elements in which every element has link to its next element and last element link to its first element.
Graphical representation:
Stack:
Stack is a linear data structures, in which operations are performed based on LIFO principle (Last In First Out).
Queue is a linear data structures, in which operations are performed based on FIFO principle (First In First Out).
Trees:
A tree is a non-linear data structures, that consists of nodes connected by edges.
Graphical representation:
Graph:
Graph is a non-linear data structure, it contains a set of points known as nodes(vertices) and set of links as edges(arcs).Here edges are used to connect the vertices.
Graphical representation:
directed graph |