Professional Documents
Culture Documents
DS - Unit 1-1
DS - Unit 1-1
Data Structure
The organized collection of data in a mathematical or logical way is called Data Structure.
OR
A way of storing and organizing data in a computer is called data structure.
Classification of Data Structure:
Data
Structure
float Graphs
Linked List
Double
Stack
Queue
Primitive Data Structure: A data structure can be manipulated by machine level instructions
is called primitive data structure. Example: int, float, char, double, long etc.
Non-Primitive Data Structure: A data structure which cannot be manipulated directly by
machine level instructions is called non-primitive data structure. They are two types:
1. Linear Data Structure
2. Non-linear Data Structure
Linear Data Structure: A Data Structure which stores all the elements sequentially in memory
is called linear Data Structure. Example: Array, Linked List, Stack and Queue.
Array: It is a definite collection of homogenous elements that can be stored sequentially.
Example: int A[3];
Memory representation of an array
101 102 103 104 105 106 107 108
50 60 70 80 NULL
The types of linked list are:
1. Singly List
2. Doubly List
3. Circular List
Stack: It is a linear data structure, the data can be inserted and deleted at one end is known
TOP. Stack works in the fashion of LIFO.
C top
B
A
Queue: Queue is a linear data structure which has two ends. One end is used to insert the
element named as REAR and the other end is used to delete the element named as FRONT.
FRONT REAR
A B C D E F G
Non-Linear Data Structure
Data structures where data elements are not arranged sequentially or linearly are called non-
lineardata structures. Example: Tree, Graph.
Tree: It is a finite set of nodes or vertices each tree has a root node and remaining nodes are
considered as leaf nodes or sub trees.
B C
D E
B C