|| JAI SRI GURUDEV ||
SRI ADICHUNCHANAGIRI SHIKSHANA TRUST ®
ADICHUNCHANAGIRI INSTITUTE OF TECHNOLOGY
(An ISO 9001 : 2008 Certified)
Affiliated to Visvesvaraya Technological University, Belagavi ,
Approved by AICTE and Accredited by NAAC, New Delhi
Jyothinagar, Chikkamagaluru – 577 102.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
ONLINE CLASS USING ZOOM APPLICATION
Subject: Data Structures and Applications
Subject Code: 18CS32
Presented By: Semester and Section : 3rd and ‘A’
Mr. GOPINATH C. B., B.E., M.Tech., Class # : 21
Assistant Professor
29 September 2020 Date : 29-09-2020 (02:30PM TO 04:30PM)
MODULE - 1
Introduction: Data Structures, Classifications (Primitive & Non-primitive),
Data structure Operations, Review of Arrays, Structures, Self-Referential
Structures, and Unions. Pointers and Dynamic Memory Allocation Functions.
Representation of Linear Arrays in Memory, Dynamically allocated arrays.
Array Operations: Traversing, inserting, deleting, searching, and sorting.
Multidimensional Arrays, Polynomials and Sparse Matrices.
Strings: Basic Terminology, Storing, Operations and Pattern Matching
algorithms. Programming Examples.
Data Structures
Definition:
Data may be organized in many different ways. The logical or mathematical
model of a particular organization of data is called a Data Structure.
The Data Structures mainly deals with the study of :
How efficiently the data can be stored in a computer/memory.
How efficiently the data can be organized in a computer/memory.
How efficiently the data can be retrieved from the computer/memory.
Classification of Data Structures OR Types of Data Structures:
Data structures are generally classified into two types
Primitive Data Structures
Non-primitive Data Structures
Primitive Data Structures:
Primitive data structures are the fundamental data types which are supported
by a programming language.
Examples: integer, real, character and boolean.
The term ‘data type’, ‘basic data type’ and ‘primitive data type’ are often used
interchangeably.
Non-primitive Data Structures:
Non-primitive data structures are those data structures which are created
using primitive data structures.
Examples: arrays, linked lists, stacks, queues, trees and graphs.
Non-primitive data structures can further be classified into two types
Linear Data Structures
Non-linear Data Structures
Linear Data Structures:
In Linear data structures, the elements of a data structure are stored in a
linear or sequential order.
Examples: arrays, linked lists, stacks and queues
Non-linear Data Structures:
In Non-linear data structures, the elements of a data structure are not stored
in a sequential order.
Examples: trees and graphs
Data Structures
Primitive Data Structures Non-primitive Data Structures
Integer Arrays
Real Linked Lists
Character Stacks
Queues
Boolean
Trees
Graphs
Linear Data Structures Non-linear Data Structures
Arrays Trees
Linked Lists Graphs
Stacks
Queues
Figure: Classification of Data Structures.
Primitive Data Structures:
Integer: It is used to store whole numbers and it is denoted by keyword ‘int’.
Example: 10, -10, etc.,
Real: It is used to store real numbers.
Single Precision Floating Point: It is denoted by keyword ‘float’.
Example: 3.142623, 10.000222, etc.,
Double Precision Floating Point: It is denoted by keyword ‘double’.
Example: 2.1234567891234567, etc.,
Character: It is used to store characters and it is denoted by keyword ‘char’.
Example: ‘A’, “india”, etc.,
Boolean: It is used to store true or false. Every non-zero value corresponds to true and
0 value corresponds to false and it is denoted by keyword ‘bool’.
Example: bool x = false;
Where bool is a keyword and defined in “stdbool.h” header file.
Non-primitive Data Structures:
Arrays: An array is a collection of elements of same data type and stored in
consecutive memory locations. Referenced by an index or subscript.
Stacks: A stack is a linear data structure in which insertion and deletion of elements
are done at only one end, which is known as the top of the stack. Stack is also called as
Last-In, First-Out (LIFO).
Queues: A queue is a linear data structure in which the element that is inserted first is
the first one to be taken out. The elements in a queue are added at one end called the
rear and removed from the other end called the front. Queue is also called as First-In,
First-Out (FIFO).
Linked Lists: A linked list is a set of dynamically allocated nodes, arranged in such a
way that each node contains one value and one pointer. The pointer always points to
the next member of the list. If the pointer is NULL, then it is the last node in the list.
Non-primitive Data Structures (Contd…):
Trees: A tree is a non-linear data structure which consists of a collection of nodes
arranged in a hierarchical order. One of the nodes is designated as the root node and
the remaining nodes can be partitioned into disjoint sets such that each set is a sub-
tree of the root.
Graphs: A graph is a non-linear data structure which is a collection of vertices (also
called nodes) and edges that connect these vertices.
Data Structure Operations:
The different operations that can be performed on the various data
structures are
Traversing
Searching
Inserting
Deleting
Sorting
Merging
Traversing: It means to access each data item exactly once so that it can be
processed.
Example: To print the names of all the students in a class.
Searching: It is used to find the location of one or more data items that satisfy
the given constraint. Such a data item may or may not be present in the given
collection of data items.
Example: To find the names of all the students who secured 100 marks in
subject.
Inserting: It is used to add new data items to the given list of data items.
Example: To add the details of a new student who has recently joined the
course.
Deleting: It means to remove (delete) a particular data item from the given
collection of data items.
Example: To delete/remove the name of a student who has left the course.
Sorting: Data items can be arranged in some order like ascending order or
descending order depending on the type of application.
Example: Arranging the names of students in a class in an alphabetical order.
Merging: Combing the records in two different sorted files into single sorted
file.
Today’s Class Assignment Questions.
Note: Write these assignment questions in 200 pages RULED long note book.
1. What is data structure? What are the various types of data
structure? Explain in detail.
2. Define data structure. List and explain data structure
operations.
THANK YOU