SlideShare a Scribd company logo
1 of 48
Introduction to Data Structures
• Introduction to Data Structures
• Basic terminologies
• Need and Applications
• Classification of data structures
• Operations on data structures
• Abstract Data Types
What is Data Structure?
• Data – Basic fact or entity utilized in calculation or
manipulation or collection of raw facts.
• A data structure is a systematic way of organizing and
accessing data.
• Logical or mathematical model of a particular organization of
data is called data structure.
• In computer science, a data structure is a particular way of
storing and organizing data in a computer’s memory so that it
can be used efficiently.
What is Data Structure?
• Data structure affects the design of both structural &
functional aspects of a program.
Program=algorithm + Data Structure
• Algorithm is a step by step procedure to solve a particular
function.
Need of data structure
• It gives different level of organization data.
• It tells how data can be stored and accessed
in its elementary level.
• Provide operation on group of data, such as
adding an item, looking up highest priority
item.
• Provide a means to manage huge amount of
data efficiently.
• Provide fast searching and sorting of data.
Areas in which data structures are applied
extensively
• Compiler Design
• Operating System
• Database Management System
• Statistical analysis package
• Numerical Analysis
• Graphics
• Artificial Intelligence
• Simulation
Classification of data structure
• Data structure are normally divided into two
broad categories:
1. Primitive Data Structure
2. Non-Primitive Data Structure
Classification of data structure
Primitive data structure
• These are basic structures and directly operated
upon by the machine instructions.
• Data structures that are directly operated upon the
machine-level instructions are known as primitive
data structures.
• Integer, Floating-point number, Character constants,
string constants, pointers etc, fall in this category.
Non-primitive data structure
• The Data structures that are derived from the
primitive data structures are called Non-primitive
data structure.
• The non-primitive data structures emphasize on
structuring of a group of homogeneous (same type)
or heterogeneous (different type) data items.
It’s further classified in linear and nonlinear data
structure.
a) Linear data structure: In linear data structure the
item are arrange in linear sequence like an array.
b) Nonlinear data structure: In this data structure
items are not in sequence.
Linear data structure
Data structure is said to be linear if the
elements form a sequence.
i.e., while traversing sequentially, we can reach
only one element directly from another.
For example : Stack, Linked list, Queue etc.
Non linear data structure
• elements in a nonlinear data structure do not
form a sequence
• i.e each item or element may be connected
with two or more other items or elements in a
non-linear arrangement
• For example : Graphs, Trees etc.
Non-Primitive data structure
1.Static Data Structure : Static data structure are those whose
size and structure associated with memory location are fixed
at compile time . e.g. Array int no[5]
2.Dynamic Data Structure : Dynamic structures are those which
expand or shrink as required during the program execution.
e.g. Link List
Description of various
Data Structures : Arrays
• An array is defined as a set of finite
number of homogeneous elements or
same data items.
• It means an array can contain one type of
data only, either all integer, all float-point
number or all character.
Arrays
• Simply, declaration of array is as follows:
int arr[10]
• Where int specifies the data type or type of
elements arrays stores.
• “arr” is the name of array & the number
specified inside the square brackets is the
number of elements an array can store, this is
also called sized or length of array.
Arrays
• Following are some of the concepts to be
remembered about arrays:
–The individual element of an array can
be accessed by specifying name of the
array, following by index or subscript
inside square brackets.
–The first element of the array has index
zero[0]. It means the first element and
last element will be specified as:arr[0]
& arr[9]
Respectively.
Arrays
–The elements of array will always be
stored in the consecutive (continues)
memory location.
–The number of elements that can be stored
in an array, that is the size of array or its
length is given by the following equation:
(Upperbound-lowerbound)+1
Arrays
–For the above array it would be
(9-0)+1=10,where 0 is the lower
bound of array and 9 is the upper
bound of array.
–Array can always be read or written
through loop. If we read a one-
dimensional array it require one loop
for reading and other for writing the
array.
Arrays
–For example: Reading an array
For(i=0;i<=9;i++)
scanf(“%d”,&arr[i]);
–For example: Writing an array
For(i=0;i<=9;i++)
printf(“%d”,arr[i]);
Arrays
–If we are reading or writing two-
dimensional array it would require two
loops. And similarly the array of a N
dimension would required N loops.
–Some common operation performed on
array are:
• Creation of an array
• Traversing an array
Arrays
• Insertion of new element
• Deletion of required element
• Modification of an element
• Merging of arrays
Lists
• A lists (Linear linked list) can be defined as a
collection of variable number of data items.
• Lists are the most commonly used non-
primitive data structures.
• An element of list must contain at least two
fields, one for storing data or information and
other for storing address of next element.
• As you know for storing address we have a
special data structure of list the address must
be pointer type.
Lists
• Technically each such element is referred
to as a node, therefore a list can be
defined as a collection of nodes as show
bellow:
Head
AAA BBB CCC
Information field Pointer field
[Linear Liked List]
Lists
• Types of linked lists:
– Single linked list
– Doubly linked list
– Single circular linked list
– Doubly circular linked list
Stack
• A stack is also an ordered collection of
elements like arrays, but it has a special
feature that deletion and insertion of
elements can be done only from one end
called the top of the stack (TOP)
• Due to this property it is also called as last
in first out type of data structure (LIFO).
Stack
• It could be through of just like a stack of plates
placed on table in a party, a guest always takes
off a fresh plate from the top and the new plates
are placed on to the stack at the top.
• It is a non-primitive data structure.
• When an element is inserted into a stack or
removed from the stack, its base remains fixed
where the top of stack changes.
Stack
• Insertion of element into stack is called
PUSH and deletion of element from stack
is called POP.
• The bellow show figure how the
operations take place on a stack:
PUSH POP
[STACK]
Stack
• The stack can be implemented into two
ways:
–Using arrays (Static implementation)
–Using pointer (Dynamic
implementation)
Queue
• Queue are first in first out type of data
structure (i.e. FIFO)
• In a queue new elements are added to the
queue from one end called REAR end and
the element are always removed from other
end called the FRONT end.
• The people standing in a railway reservation
row are an example of queue.
Queue
• Each new person comes and stands at the
end of the row and person getting their
reservation confirmed get out of the row
from the front end.
• The bellow show figure how the
operations take place on a stack:
10 20 30 40 50
front rear
Queue
• The queue can be implemented into two
ways:
–Using arrays (Static implementation)
–Using pointer (Dynamic
implementation)
Trees
• A tree can be defined as finite set of data
items (nodes).
• Tree is non-linear type of data structure in
which data items are arranged or stored in
a sorted sequence.
• Tree represent the hierarchical
relationship between various elements.
Trees
• In trees: There is a special data item at the
top of hierarchy called the Root of the tree.
• The remaining data items are partitioned into
number of mutually exclusive subset, each of
which is itself, a tree which is called the sub
tree.
• The tree always grows in length towards
bottom in data structures, unlike natural trees
which grows upwards.
Trees
• The tree structure organizes the data into
branches, which related the information.
A
B C
D E F G
root
Graph
• Graph is a mathematical non-linear data
structure capable of representing many
kind of physical structures.
• It has found application in Geography,
Chemistry and Engineering sciences.
• Definition: A graph G(V,E) is a set of
vertices V and a set of edges E.
Graph
• An edge connects a pair of vertices and
many have weight such as length, cost and
another measuring instrument for
according the graph.
• Vertices on the graph are shown as point
or circles and edges are drawn as arcs or
line segment.
Graph
• Example of graph:
v2
v1
v4
v5
v3
10
15
8
6
11
9
v4
v1
v2
v4
v3
[a] Directed &
Weighted Graph
[b] Undirected Graph
Graph
• Types of Graphs:
–Directed graph
–Undirected graph
–Simple graph
–Weighted graph
–Connected graph
–Non-connected graph
Quiz
• Classify following data structures in linear and
non linear
1. Tree
2. Array
3. Linked List
4. Stack
5. Graph
6. Queue
DATA STRUCTURE OPERATIONS
• data structure is used for the storage of data
in computer so that data can be used efficiently
• The data manipulation within the data structures are
performed by means of certain operations
The following operations play a major role on data structures.
a) Traversing : accessing each data exactly once so that each
data items is traversed or visited.
b) Searching : finding the location of the data within data
structure which satisfy searching condition or criteria.
c) Inserting : adding a new data in the data structure.
d) Deleting : removing a data from the data structure.
Sometimes two or more of these operations may be used in a
given situation. For example, if we want to delete a record
with a given key value, at first we will have need to search for
the location of the record and then delete that record.
• The following two operations are also used in some special
situations :
e) Sorting : Arranging the data in some logical order e. g.,
increasing or decreasing, with numerical data, or
alphabetically, with character data.
f) Merging : combining the data of two different sorted files
into a single sorted file.
MCQ
1. List out the areas in which data structures
are applied extensively? (asked in TCS)
2. What is Data Structure?
3 Which are the types of data structure? State
the type of array data structure.
4. What is the need of data structure?
12.46
Abstract Data Type
Problem solving with a computer means processing
data. To process data, we need to define the data type
and the operation to be performed on the data. The
definition of the data type and the definition of the
operation to be applied to the data is part of the idea
behind an abstract data type (ADT)—to hide how the
operation is performed on the data. In other words, the
user of an ADT needs only to know that a set of
operations are available for the data type, but does not
need to know how they are applied.
Abstract Data Type
• Collection of data items together with the
operations on the data.
• The word “abstract” refers to the fact that the
data and the basic operations defined on it
are being studied independently of how they
are implemented.
• It involves what can be done with the data,
not how has to be done.
Abstract Data Type
• When we use ADT our program divided into 2
parts:
• 1. The Application
• 2 The Implementation
Application
Specification
Implementation
Uses ADT
Defines ADT
Implements ADT

More Related Content

Similar to Unit 1.ppt

1.1 introduction to Data Structures.ppt
1.1 introduction to Data Structures.ppt1.1 introduction to Data Structures.ppt
1.1 introduction to Data Structures.pptAshok280385
 
Data structures - unit 1
Data structures - unit 1Data structures - unit 1
Data structures - unit 1SaranyaP45
 
data structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptxdata structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptxcoc7987515756
 
CHAPTER-1- Introduction to data structure.pptx
CHAPTER-1- Introduction to data structure.pptxCHAPTER-1- Introduction to data structure.pptx
CHAPTER-1- Introduction to data structure.pptxOnkarModhave
 
DS Module1 (1).pptx
DS Module1 (1).pptxDS Module1 (1).pptx
DS Module1 (1).pptxAnuJoseph95
 
Data structure chapter 1.pptx
Data structure chapter 1.pptxData structure chapter 1.pptx
Data structure chapter 1.pptxKami503928
 
Lecture 01 Intro to DSA
Lecture 01 Intro to DSALecture 01 Intro to DSA
Lecture 01 Intro to DSANurjahan Nipa
 
Data Structure # vpmp polytechnic
Data Structure # vpmp polytechnicData Structure # vpmp polytechnic
Data Structure # vpmp polytechniclavparmar007
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyMalikireddy Bramhananda Reddy
 
data structures module I & II.pptx
data structures module I & II.pptxdata structures module I & II.pptx
data structures module I & II.pptxrani marri
 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptyarotos643
 
Data Structure & Algorithm.pptx
Data Structure & Algorithm.pptxData Structure & Algorithm.pptx
Data Structure & Algorithm.pptxMumtaz
 

Similar to Unit 1.ppt (20)

1.1 introduction to Data Structures.ppt
1.1 introduction to Data Structures.ppt1.1 introduction to Data Structures.ppt
1.1 introduction to Data Structures.ppt
 
Data structures - unit 1
Data structures - unit 1Data structures - unit 1
Data structures - unit 1
 
data structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptxdata structure unit -1_170434dd7400.pptx
data structure unit -1_170434dd7400.pptx
 
lecture 02.2.ppt
lecture 02.2.pptlecture 02.2.ppt
lecture 02.2.ppt
 
CHAPTER-1- Introduction to data structure.pptx
CHAPTER-1- Introduction to data structure.pptxCHAPTER-1- Introduction to data structure.pptx
CHAPTER-1- Introduction to data structure.pptx
 
intr_ds.ppt
intr_ds.pptintr_ds.ppt
intr_ds.ppt
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
DSA - Copy.pptx
DSA - Copy.pptxDSA - Copy.pptx
DSA - Copy.pptx
 
DS Module1 (1).pptx
DS Module1 (1).pptxDS Module1 (1).pptx
DS Module1 (1).pptx
 
Data structure
Data structureData structure
Data structure
 
Dsa unit 1
Dsa unit 1Dsa unit 1
Dsa unit 1
 
Data structure chapter 1.pptx
Data structure chapter 1.pptxData structure chapter 1.pptx
Data structure chapter 1.pptx
 
Lecture 01 Intro to DSA
Lecture 01 Intro to DSALecture 01 Intro to DSA
Lecture 01 Intro to DSA
 
Data Structure # vpmp polytechnic
Data Structure # vpmp polytechnicData Structure # vpmp polytechnic
Data Structure # vpmp polytechnic
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
 
TSAT Presentation1.pptx
TSAT Presentation1.pptxTSAT Presentation1.pptx
TSAT Presentation1.pptx
 
data structures module I & II.pptx
data structures module I & II.pptxdata structures module I & II.pptx
data structures module I & II.pptx
 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
 
Data Structure & Algorithm.pptx
Data Structure & Algorithm.pptxData Structure & Algorithm.pptx
Data Structure & Algorithm.pptx
 

More from Minakshee Patil

More from Minakshee Patil (7)

Lecture2 (9).ppt
Lecture2 (9).pptLecture2 (9).ppt
Lecture2 (9).ppt
 
oracle.pptx
oracle.pptxoracle.pptx
oracle.pptx
 
Lecture1.ppt
Lecture1.pptLecture1.ppt
Lecture1.ppt
 
Hierarchical clustering algorithm.pptx
Hierarchical clustering algorithm.pptxHierarchical clustering algorithm.pptx
Hierarchical clustering algorithm.pptx
 
Lecture2 (1).ppt
Lecture2 (1).pptLecture2 (1).ppt
Lecture2 (1).ppt
 
Lecture3 (3).ppt
Lecture3 (3).pptLecture3 (3).ppt
Lecture3 (3).ppt
 
Lecture4.ppt
Lecture4.pptLecture4.ppt
Lecture4.ppt
 

Recently uploaded

Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 

Recently uploaded (20)

Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 

Unit 1.ppt

  • 1. Introduction to Data Structures • Introduction to Data Structures • Basic terminologies • Need and Applications • Classification of data structures • Operations on data structures • Abstract Data Types
  • 2. What is Data Structure? • Data – Basic fact or entity utilized in calculation or manipulation or collection of raw facts. • A data structure is a systematic way of organizing and accessing data. • Logical or mathematical model of a particular organization of data is called data structure. • In computer science, a data structure is a particular way of storing and organizing data in a computer’s memory so that it can be used efficiently.
  • 3. What is Data Structure? • Data structure affects the design of both structural & functional aspects of a program. Program=algorithm + Data Structure • Algorithm is a step by step procedure to solve a particular function.
  • 4. Need of data structure • It gives different level of organization data. • It tells how data can be stored and accessed in its elementary level. • Provide operation on group of data, such as adding an item, looking up highest priority item. • Provide a means to manage huge amount of data efficiently. • Provide fast searching and sorting of data.
  • 5. Areas in which data structures are applied extensively • Compiler Design • Operating System • Database Management System • Statistical analysis package • Numerical Analysis • Graphics • Artificial Intelligence • Simulation
  • 6. Classification of data structure • Data structure are normally divided into two broad categories: 1. Primitive Data Structure 2. Non-Primitive Data Structure
  • 8. Primitive data structure • These are basic structures and directly operated upon by the machine instructions. • Data structures that are directly operated upon the machine-level instructions are known as primitive data structures. • Integer, Floating-point number, Character constants, string constants, pointers etc, fall in this category.
  • 9. Non-primitive data structure • The Data structures that are derived from the primitive data structures are called Non-primitive data structure. • The non-primitive data structures emphasize on structuring of a group of homogeneous (same type) or heterogeneous (different type) data items. It’s further classified in linear and nonlinear data structure. a) Linear data structure: In linear data structure the item are arrange in linear sequence like an array. b) Nonlinear data structure: In this data structure items are not in sequence.
  • 10. Linear data structure Data structure is said to be linear if the elements form a sequence. i.e., while traversing sequentially, we can reach only one element directly from another. For example : Stack, Linked list, Queue etc.
  • 11.
  • 12. Non linear data structure • elements in a nonlinear data structure do not form a sequence • i.e each item or element may be connected with two or more other items or elements in a non-linear arrangement • For example : Graphs, Trees etc.
  • 13.
  • 14. Non-Primitive data structure 1.Static Data Structure : Static data structure are those whose size and structure associated with memory location are fixed at compile time . e.g. Array int no[5] 2.Dynamic Data Structure : Dynamic structures are those which expand or shrink as required during the program execution. e.g. Link List
  • 15. Description of various Data Structures : Arrays • An array is defined as a set of finite number of homogeneous elements or same data items. • It means an array can contain one type of data only, either all integer, all float-point number or all character.
  • 16. Arrays • Simply, declaration of array is as follows: int arr[10] • Where int specifies the data type or type of elements arrays stores. • “arr” is the name of array & the number specified inside the square brackets is the number of elements an array can store, this is also called sized or length of array.
  • 17. Arrays • Following are some of the concepts to be remembered about arrays: –The individual element of an array can be accessed by specifying name of the array, following by index or subscript inside square brackets. –The first element of the array has index zero[0]. It means the first element and last element will be specified as:arr[0] & arr[9] Respectively.
  • 18. Arrays –The elements of array will always be stored in the consecutive (continues) memory location. –The number of elements that can be stored in an array, that is the size of array or its length is given by the following equation: (Upperbound-lowerbound)+1
  • 19. Arrays –For the above array it would be (9-0)+1=10,where 0 is the lower bound of array and 9 is the upper bound of array. –Array can always be read or written through loop. If we read a one- dimensional array it require one loop for reading and other for writing the array.
  • 20. Arrays –For example: Reading an array For(i=0;i<=9;i++) scanf(“%d”,&arr[i]); –For example: Writing an array For(i=0;i<=9;i++) printf(“%d”,arr[i]);
  • 21. Arrays –If we are reading or writing two- dimensional array it would require two loops. And similarly the array of a N dimension would required N loops. –Some common operation performed on array are: • Creation of an array • Traversing an array
  • 22. Arrays • Insertion of new element • Deletion of required element • Modification of an element • Merging of arrays
  • 23. Lists • A lists (Linear linked list) can be defined as a collection of variable number of data items. • Lists are the most commonly used non- primitive data structures. • An element of list must contain at least two fields, one for storing data or information and other for storing address of next element. • As you know for storing address we have a special data structure of list the address must be pointer type.
  • 24. Lists • Technically each such element is referred to as a node, therefore a list can be defined as a collection of nodes as show bellow: Head AAA BBB CCC Information field Pointer field [Linear Liked List]
  • 25. Lists • Types of linked lists: – Single linked list – Doubly linked list – Single circular linked list – Doubly circular linked list
  • 26. Stack • A stack is also an ordered collection of elements like arrays, but it has a special feature that deletion and insertion of elements can be done only from one end called the top of the stack (TOP) • Due to this property it is also called as last in first out type of data structure (LIFO).
  • 27. Stack • It could be through of just like a stack of plates placed on table in a party, a guest always takes off a fresh plate from the top and the new plates are placed on to the stack at the top. • It is a non-primitive data structure. • When an element is inserted into a stack or removed from the stack, its base remains fixed where the top of stack changes.
  • 28. Stack • Insertion of element into stack is called PUSH and deletion of element from stack is called POP. • The bellow show figure how the operations take place on a stack: PUSH POP [STACK]
  • 29. Stack • The stack can be implemented into two ways: –Using arrays (Static implementation) –Using pointer (Dynamic implementation)
  • 30. Queue • Queue are first in first out type of data structure (i.e. FIFO) • In a queue new elements are added to the queue from one end called REAR end and the element are always removed from other end called the FRONT end. • The people standing in a railway reservation row are an example of queue.
  • 31. Queue • Each new person comes and stands at the end of the row and person getting their reservation confirmed get out of the row from the front end. • The bellow show figure how the operations take place on a stack: 10 20 30 40 50 front rear
  • 32. Queue • The queue can be implemented into two ways: –Using arrays (Static implementation) –Using pointer (Dynamic implementation)
  • 33. Trees • A tree can be defined as finite set of data items (nodes). • Tree is non-linear type of data structure in which data items are arranged or stored in a sorted sequence. • Tree represent the hierarchical relationship between various elements.
  • 34. Trees • In trees: There is a special data item at the top of hierarchy called the Root of the tree. • The remaining data items are partitioned into number of mutually exclusive subset, each of which is itself, a tree which is called the sub tree. • The tree always grows in length towards bottom in data structures, unlike natural trees which grows upwards.
  • 35. Trees • The tree structure organizes the data into branches, which related the information. A B C D E F G root
  • 36. Graph • Graph is a mathematical non-linear data structure capable of representing many kind of physical structures. • It has found application in Geography, Chemistry and Engineering sciences. • Definition: A graph G(V,E) is a set of vertices V and a set of edges E.
  • 37. Graph • An edge connects a pair of vertices and many have weight such as length, cost and another measuring instrument for according the graph. • Vertices on the graph are shown as point or circles and edges are drawn as arcs or line segment.
  • 38. Graph • Example of graph: v2 v1 v4 v5 v3 10 15 8 6 11 9 v4 v1 v2 v4 v3 [a] Directed & Weighted Graph [b] Undirected Graph
  • 39. Graph • Types of Graphs: –Directed graph –Undirected graph –Simple graph –Weighted graph –Connected graph –Non-connected graph
  • 40. Quiz • Classify following data structures in linear and non linear 1. Tree 2. Array 3. Linked List 4. Stack 5. Graph 6. Queue
  • 41. DATA STRUCTURE OPERATIONS • data structure is used for the storage of data in computer so that data can be used efficiently • The data manipulation within the data structures are performed by means of certain operations The following operations play a major role on data structures. a) Traversing : accessing each data exactly once so that each data items is traversed or visited. b) Searching : finding the location of the data within data structure which satisfy searching condition or criteria.
  • 42. c) Inserting : adding a new data in the data structure. d) Deleting : removing a data from the data structure. Sometimes two or more of these operations may be used in a given situation. For example, if we want to delete a record with a given key value, at first we will have need to search for the location of the record and then delete that record.
  • 43. • The following two operations are also used in some special situations : e) Sorting : Arranging the data in some logical order e. g., increasing or decreasing, with numerical data, or alphabetically, with character data. f) Merging : combining the data of two different sorted files into a single sorted file.
  • 44. MCQ
  • 45. 1. List out the areas in which data structures are applied extensively? (asked in TCS) 2. What is Data Structure? 3 Which are the types of data structure? State the type of array data structure. 4. What is the need of data structure?
  • 46. 12.46 Abstract Data Type Problem solving with a computer means processing data. To process data, we need to define the data type and the operation to be performed on the data. The definition of the data type and the definition of the operation to be applied to the data is part of the idea behind an abstract data type (ADT)—to hide how the operation is performed on the data. In other words, the user of an ADT needs only to know that a set of operations are available for the data type, but does not need to know how they are applied.
  • 47. Abstract Data Type • Collection of data items together with the operations on the data. • The word “abstract” refers to the fact that the data and the basic operations defined on it are being studied independently of how they are implemented. • It involves what can be done with the data, not how has to be done.
  • 48. Abstract Data Type • When we use ADT our program divided into 2 parts: • 1. The Application • 2 The Implementation Application Specification Implementation Uses ADT Defines ADT Implements ADT