Page 82 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 82
Manmohan Sharma, Lovely Professional University Unit 6: Operations on Arrays and Sparse Matrices
Unit 6: Operations on Arrays and Sparse Matrices Notes
CONTENTS
Objectives
Introduction
6.1 Operations on Array
6.2 Sparse Matrices and their Storage
6.2.1 Sparse Matrix Storage Formats
6.3 Summary
6.4 Keywords
6.5 Review Questions
6.6 Further Readings
Objectives
After studying this unit, you will be able to:
Discuss operations on arrays
Explain the concept of sparse matrices
Discuss storage of sparse matrices
Introduction
An array in C Programing Language can be defined as number of memory locations, each of
which can store the same data type and which can be references through the same variable name.
An array is a collective name given to a group of similar quantities. These similar quantities
could be percentage marks of 100 students, number of chairs in home, or salaries of 300 employees
or ages of 25 students. Thus an array is a collection of similar elements. These similar elements
could be all integers or all floats or all characters etc. Usually, the array of characters is called a
“string”, where as an array of integers or floats is called simply an array. In this unit, we will
discuss operations on arrays. Also, we will discuss the concept of sparse matrices.
6.1 Operations on Array
The array is a homogeneous structure, i.e. the elements of an array are of the same type. It is
infinite; it has a specified number of elements. An array is ordered; there is an ordering of
elements in it as zeroth, first, second etc. Following set of operations are defined for this structure.
Creating an array
Initialising an array
Storing an element
Retrieving an element
Inserting an element
LOVELY PROFESSIONAL UNIVERSITY 75