XII CS Chapter Data Structures Notes
XII CS Chapter Data Structures Notes
Chapter 3
Data Structures and Operations
Data structure is a particular way of organising logically related data items which can be
processed as a single unit.
Classification of data structures
Depending upon memory allocation, data structures may be classified as static data
structures and dynamic data structures. Memory allocation is fixed for static data
structures (eg: arrays) and the size cannot be changed during execution. Memory is
allocated during execution for dynamic data structures (eg: linked list) and the size changes
according to the addition or deletion of data items.
7: Else
8: Print "Queue Overflow "
9: End of If
Stop
Algorithm for Deletion:
Assume that Q[N] is an array of queue with size N and FRONT and REAR denote the front
and rear positions of the queue. Let VAL be a variable to store the deleted data.
Start
1: If (FRONT > -1) Then // Empty status checking
2: VAL = Q[FRONT]
3: FRONT = FRONT + 1
4: Else
5: Print "Queue Underflow "
6: End of If
7: If (FRONT > REAR) Then // Checking the deletion of last element
8: FRONT = REAR = -1
9: End of If
Stop
Circular queue
It is a queue in which the two end points meet. Its advantage over linear queue is that space
utilization is the maximum. Overflow occurs only if all the locations are filled with data
items.