Module 1
Module 1
Module 1
INTRODUCTION TO DATA STRUCTURES
Basic Terminology
Data: The term data means a value or set of value. (e.g., marks of students, name of an employee).
ii. Group Item: Data items that can be divided into sub-items. (name can be divided into firstname,
lastname and middle name).
Record: A record is a collection of data items. (e.g., the name, address, course, and marks of a
student forms a record ).
File: A file is a collection of related records. For example, if there are 60 students in a class, then
there are 60 records of the students. All these related records are stored in a file.
Primary key: Data item that uniquely identifies a record in a file. (e.g., USN of a student).
Data Structures
Definition:
The logical or mathematical model of a particular organization of data is called Data Structure.
Need for data structures: To store and manipulate the data easily.
Two considerations while choosing a Data Structure:
1. Primitive: Primitive data structures are the fundamental data types which are supported by a
programming language. Ex. integer, real, character, and boolean.
2. Non-Primitive: Non-primitive data structures are those data structures which are created using
primitive data structures. Examples inked lists, stacks, trees, and graphs.
Are of two types:
i. Linear Structures: The elements of a data structure are stored in a linear or sequential order.
Ex. arrays, linked lists, stacks, and queues.
ii. Non-Linear: The elements are not stored in a sequential order, then it is a non-linear data
structure. Ex. Trees, Graphs.
Types of data structures: Examples:
1. Arrays
An array is a collection of similar data elements. These data elements have the same data type.
The elements of the array are stored in consecutive memory locations and are referenced by an
index (also known as the subscript). It starts from 0(zero).
In C, Syntax: type name[size];
example, int marks[10];
The