Professional Documents
Culture Documents
Data Structures
Integer
Linear Data Non-Linear
Floating point Structure Data Structure
Queues
Linked List
Files
Primitive data structure:
Data structures that are directly operated/manipulated by the machine instructions are
known as primitive data structure.
The integer, real (float), character, pointers are the primitive data structures
2 25
1002
3 89
1003
Subscript 4 36
1004 Location address
5 77
1005
. 29
.
. ..
.
n-1 .
.
..
Associated with each element in the memory there is a subscript and the memory address
location.
The starting address of an array is called the “base address(B)”.
The number of bytes used to represent the element in the memory is called word size(W).
Address of an array element with subscript I in the array can be computed using the following
relation.
A[i] = Base address + i * word size
A[i] = B + I * W
A[0] = 1000 + 0 * 2 = 1000
A[1] = 1000 + 1 * 2 = 1002
A[2] = 1000 + 2 * 2 = 1003
A[3] = 1000 + 3 * 2 = 1004
……………………………………………
Basic operations on one dimensional array:
The operations which are performed on one dimensional array
1. Traversal: Traversing means accessing each element exactly once so that the elements
of a data structure can be processed. Traversing is also called as visiting.
2. Insertion: The process of adding a new data item in the given collection of data items.
3. Deletion: The process of deleting an existing data item from the given collection of data
items.
4. Searching: The process of finding the location of the data item if it exists in the given
collection of data items.
5. Sorting: The process of arranging the data items in some order i.e. in ascending or
descending order.