SlideShare a Scribd company logo
1 of 47
DATA STRUCTURES AND APPLICATIONS
COURSE CODE-BCS304
MRS. MEGHA S. KULKARNI
Module-1 8Hours
INTRODUCTION TO DATA STRUCTURES:
Data Structures Definition and overview
Classifications (Primitive & Non-Primitive)
Data structure Operations
Review of pointers and dynamic Memory Allocation
ARRAYS and STRUCTURES: Arrays, Dynamic Allocated Arrays
Structures and Unions, Polynomials, Sparse Matrices, representation of
Multidimensional Arrays, Strings
STACKS: Stacks, Stacks Using Dynamic Arrays, Evaluation and conversion of
Expressions
DEFINITION
 Data structure is logical or mathematical model of storing
and organizing data in a particular way in a computer.
 In other words, a data structure is a way of organizing all data
items that considers not only the elements stored but also
their relationship to each other.
INTRODUCTION
 Data structure affects the design of both structural &
functional aspects of a program.
Program=algorithm + Data Structure
 A algorithm is a step by step procedure to solve a particular
function.
THE STUDY OF DS INCLUDES:
 Defining operations that can be performed on
data.
 Representing data in the memory.
 Determining amount of memory required to
store and the amount of time needed to process
the data.
NEED FOR DATA STRUCTURES:
Computers are electronic data processing
machines and to solve a particular problem we
need to know:
 How to represent data in computers?
 How to access them?
 What are the steps to be performed to get the
needed output?
CLASSIFICATION OF DATA STRUCTURES:
Data structure are divided into two categories:
 Primitive Data Structure
 Non-Primitive Data Structure
CLASSIFICATION OF DATA STRUCTURES:
Data structure
Primitive DS Non-Primitive DS
Integer Float Character Pointer
Float
Integer Float
CLASSIFICATION OF DATA STRUCTURES:
Non-Primitive DS
Linear List Non-Linear List
Array
Link List Stack
Queue Graph Trees
PRIMITIVE DATA STRUCTURES:
 These are the fundamental standard data types.
 These are used to represent single value.
 Integer, Floating-point number, Character constants,
string constants, pointers etc, fall in this category.
NON-PRIMITIVE DATA STRUCTURES:
 There are more sophisticated data structures.
 These are derived from the primitive data structures.
 The non-primitive data structures emphasize on
structuring of a group of homogeneous (same type) or
heterogeneous (different type) data items.
NON-PRIMITIVE DATA STRUCTURES:
 Lists, Stack, Queue, Tree, Graph are example of non-
primitive data structures.
 The design of an efficient data structure must take
operations to be performed on the data structure.
DATA STRUCTURE OPERATIONS:
 The most commonly used operation on data structure are
broadly categorized into following types:
 Create
 Selection
 Updating
 Searching
 Sorting
 Merging
 Destroy or Delete
DIFFERENT BETWEEN THEM
 A primitive data structure is generally a basic structure
that is usually built into the language, such as an integer,
a float.
 A non-primitive data structure is built out of primitive
data structures linked together in meaningful ways, such
as a or a linked-list, binary search tree, AVL Tree, graph
etc.
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
 Declaration of array is as follows:
Syntax: datatype name[size];
Ex: 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 requires 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.
Declaration of 2 Dimensional array :
Syntax:
 data type variable_name[row_size][col_size];
 Where
data-type = int, float, char;
variable_name = array name;
ARRAYS
 Insertion of new element
 Deletion of required element
 Modification of an element
 Merging of arrays
REVIEW OF POINTERS:
A pointer is a variable that stores the address of another
variable.
Steps to use pointers: EX:
 Declare a variable int a;
 Declare a pointer variable int *pa;
 Initialize a pointer variable pa=&a;
 Access the pointer printf(“value of a=%d”,*pa);
STRUCTURES AND UNIONS
 Arrays are collections of same data type. C provides an alternate way to
group heterogeneous data items that permits the data to vary in type, this
mechanism is called as structure.
 Syntax:
struct structureName
{
dataType member1;
dataType member2;
...
};
 Ex:
struct Person
{
char name[50];
int citNo;
float salary;
};
CREATING STRUCTURE VARIALES
struct Person
{
// code
};
int main()
{
struct Person person1, person2, p[20]; return 0;
}
// another way
struct Person
{
// code
} person1, person2, p[20];
ACCESSING AND INITIALIZING MEMBERS:
person2.salary
 We can initialize structure members in 3 ways which are as follows:
1. Using Assignment Operator.
2. Using Initialized List.
 1. Initialization using Assignment Operator
struct structure_name str;
str.member1 = value1;
str.member2 = value2;
str.member3 = value3; . . .
2. Initialization using Initializer List
struct structure_name str = { value1, value2, value3 };
 In this type of initialization, the values are assigned in sequential
order as they are declared in the structure template.
TYPEDEFINED STRUCTURES(TYPEDEF):
 The typedef is a keyword that is used to provide existing data types
with a new name.
 The C typedef keyword is used to redefine the name of already
existing data types.
 When names of data types become difficult to use in programs,
typedef is used with user-defined data types, which behave similarly
to defining an alias for commands.
 C typedef Syntax:
typedef existing_name alias_name;
After this declaration, we can use the alias_name as if it was the
real existing_name in our C program.
typedef struct
{
type1 member1;
type2 member2;
------
------
}typedef_structure_name;
EX:
typedef struct
{
char name[30];
int age;
int rno;
}student;
Creating variable:
typedef_name variable;
Ex: student cse;
UNIONS:
 A union declaration is similar to a structure, but the fields
of a union must share their memory space.
 This means that only one field of the union is “active” at
any given time.
union tag_name union student
{ {
type1 member1; char name[20];
type2 member2; int age;
------ int rno;
------ };
type_n member_n;
}
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

More Related Content

Similar to DS_PPT.ppt

DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptyarotos643
 
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 Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Raj Naik
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEVenugopalavarma Raja
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdfSulabhPawaia
 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEshubhamrohiwal6
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxSaralaT3
 
DATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESDATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESsuthi
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxsarala9
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data StructureJazz Jinia Bhowmik
 
Data Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxData Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxmexiuro901
 
Data structures introduction
Data structures   introductionData structures   introduction
Data structures introductionmaamir farooq
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Tutort Academy
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structurechouguleamruta24
 

Similar to DS_PPT.ppt (20)

1597380885789.ppt
1597380885789.ppt1597380885789.ppt
1597380885789.ppt
 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
 
intr_ds.ppt
intr_ds.pptintr_ds.ppt
intr_ds.ppt
 
data structures module I & II.pptx
data structures module I & II.pptxdata structures module I & II.pptx
data structures module I & II.pptx
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf
 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGE
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
DATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESDATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTES
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
 
Data structure
Data structureData structure
Data structure
 
Intro ds
Intro dsIntro ds
Intro ds
 
Data Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptxData Structures and algoithms Unit - 1.pptx
Data Structures and algoithms Unit - 1.pptx
 
Data Structure Basics
Data Structure BasicsData Structure Basics
Data Structure Basics
 
Data structures introduction
Data structures   introductionData structures   introduction
Data structures introduction
 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
 

More from MeghaKulkarni27

Note for Java Programming////////////////
Note for Java Programming////////////////Note for Java Programming////////////////
Note for Java Programming////////////////MeghaKulkarni27
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 
Different string operations....................
Different string operations....................Different string operations....................
Different string operations....................MeghaKulkarni27
 
virtual reality...............................
virtual reality...............................virtual reality...............................
virtual reality...............................MeghaKulkarni27
 
linkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptxlinkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptxMeghaKulkarni27
 
circularlinklist-190205164051.pptx
circularlinklist-190205164051.pptxcircularlinklist-190205164051.pptx
circularlinklist-190205164051.pptxMeghaKulkarni27
 
queueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptxqueueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptxMeghaKulkarni27
 

More from MeghaKulkarni27 (11)

Note for Java Programming////////////////
Note for Java Programming////////////////Note for Java Programming////////////////
Note for Java Programming////////////////
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Different string operations....................
Different string operations....................Different string operations....................
Different string operations....................
 
virtual reality...............................
virtual reality...............................virtual reality...............................
virtual reality...............................
 
positive.pptx
positive.pptxpositive.pptx
positive.pptx
 
linkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptxlinkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptx
 
circularlinklist-190205164051.pptx
circularlinklist-190205164051.pptxcircularlinklist-190205164051.pptx
circularlinklist-190205164051.pptx
 
linkedlist.pptx
linkedlist.pptxlinkedlist.pptx
linkedlist.pptx
 
queueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptxqueueppt-191018053228 (1).pptx
queueppt-191018053228 (1).pptx
 
queue_final.pptx
queue_final.pptxqueue_final.pptx
queue_final.pptx
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 

Recently uploaded

Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...ssuserdfc773
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdfKamal Acharya
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxkalpana413121
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesChandrakantDivate1
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfsumitt6_25730773
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxMustafa Ahmed
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...ronahami
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)ChandrakantDivate1
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxhublikarsn
 

Recently uploaded (20)

Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
Convergence of Robotics and Gen AI offers excellent opportunities for Entrepr...
 
Post office management system project ..pdf
Post office management system project ..pdfPost office management system project ..pdf
Post office management system project ..pdf
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
UNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptxUNIT 4 PTRP final Convergence in probability.pptx
UNIT 4 PTRP final Convergence in probability.pptx
 
Computer Graphics Introduction To Curves
Computer Graphics Introduction To CurvesComputer Graphics Introduction To Curves
Computer Graphics Introduction To Curves
 
Introduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdfIntroduction to Data Visualization,Matplotlib.pdf
Introduction to Data Visualization,Matplotlib.pdf
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Worksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptxWorksharing and 3D Modeling with Revit.pptx
Worksharing and 3D Modeling with Revit.pptx
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...Max. shear stress theory-Maximum Shear Stress Theory ​  Maximum Distortional ...
Max. shear stress theory-Maximum Shear Stress Theory ​ Maximum Distortional ...
 
Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)Introduction to Artificial Intelligence ( AI)
Introduction to Artificial Intelligence ( AI)
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Introduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptxIntroduction to Robotics in Mechanical Engineering.pptx
Introduction to Robotics in Mechanical Engineering.pptx
 

DS_PPT.ppt

  • 1. DATA STRUCTURES AND APPLICATIONS COURSE CODE-BCS304 MRS. MEGHA S. KULKARNI
  • 2. Module-1 8Hours INTRODUCTION TO DATA STRUCTURES: Data Structures Definition and overview Classifications (Primitive & Non-Primitive) Data structure Operations Review of pointers and dynamic Memory Allocation ARRAYS and STRUCTURES: Arrays, Dynamic Allocated Arrays Structures and Unions, Polynomials, Sparse Matrices, representation of Multidimensional Arrays, Strings STACKS: Stacks, Stacks Using Dynamic Arrays, Evaluation and conversion of Expressions
  • 3. DEFINITION  Data structure is logical or mathematical model of storing and organizing data in a particular way in a computer.  In other words, a data structure is a way of organizing all data items that considers not only the elements stored but also their relationship to each other.
  • 4. INTRODUCTION  Data structure affects the design of both structural & functional aspects of a program. Program=algorithm + Data Structure  A algorithm is a step by step procedure to solve a particular function.
  • 5. THE STUDY OF DS INCLUDES:  Defining operations that can be performed on data.  Representing data in the memory.  Determining amount of memory required to store and the amount of time needed to process the data.
  • 6. NEED FOR DATA STRUCTURES: Computers are electronic data processing machines and to solve a particular problem we need to know:  How to represent data in computers?  How to access them?  What are the steps to be performed to get the needed output?
  • 7. CLASSIFICATION OF DATA STRUCTURES: Data structure are divided into two categories:  Primitive Data Structure  Non-Primitive Data Structure
  • 8. CLASSIFICATION OF DATA STRUCTURES: Data structure Primitive DS Non-Primitive DS Integer Float Character Pointer Float Integer Float
  • 9. CLASSIFICATION OF DATA STRUCTURES: Non-Primitive DS Linear List Non-Linear List Array Link List Stack Queue Graph Trees
  • 10. PRIMITIVE DATA STRUCTURES:  These are the fundamental standard data types.  These are used to represent single value.  Integer, Floating-point number, Character constants, string constants, pointers etc, fall in this category.
  • 11. NON-PRIMITIVE DATA STRUCTURES:  There are more sophisticated data structures.  These are derived from the primitive data structures.  The non-primitive data structures emphasize on structuring of a group of homogeneous (same type) or heterogeneous (different type) data items.
  • 12. NON-PRIMITIVE DATA STRUCTURES:  Lists, Stack, Queue, Tree, Graph are example of non- primitive data structures.  The design of an efficient data structure must take operations to be performed on the data structure.
  • 13. DATA STRUCTURE OPERATIONS:  The most commonly used operation on data structure are broadly categorized into following types:  Create  Selection  Updating  Searching  Sorting  Merging  Destroy or Delete
  • 14. DIFFERENT BETWEEN THEM  A primitive data structure is generally a basic structure that is usually built into the language, such as an integer, a float.  A non-primitive data structure is built out of primitive data structures linked together in meaningful ways, such as a or a linked-list, binary search tree, AVL Tree, graph etc.
  • 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  Declaration of array is as follows: Syntax: datatype name[size]; Ex: 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 requires 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. Declaration of 2 Dimensional array : Syntax:  data type variable_name[row_size][col_size];  Where data-type = int, float, char; variable_name = array name;
  • 22. ARRAYS  Insertion of new element  Deletion of required element  Modification of an element  Merging of arrays
  • 23. REVIEW OF POINTERS: A pointer is a variable that stores the address of another variable. Steps to use pointers: EX:  Declare a variable int a;  Declare a pointer variable int *pa;  Initialize a pointer variable pa=&a;  Access the pointer printf(“value of a=%d”,*pa);
  • 24. STRUCTURES AND UNIONS  Arrays are collections of same data type. C provides an alternate way to group heterogeneous data items that permits the data to vary in type, this mechanism is called as structure.  Syntax: struct structureName { dataType member1; dataType member2; ... };  Ex: struct Person { char name[50]; int citNo; float salary; };
  • 25. CREATING STRUCTURE VARIALES struct Person { // code }; int main() { struct Person person1, person2, p[20]; return 0; } // another way struct Person { // code } person1, person2, p[20];
  • 26. ACCESSING AND INITIALIZING MEMBERS: person2.salary  We can initialize structure members in 3 ways which are as follows: 1. Using Assignment Operator. 2. Using Initialized List.  1. Initialization using Assignment Operator struct structure_name str; str.member1 = value1; str.member2 = value2; str.member3 = value3; . . . 2. Initialization using Initializer List struct structure_name str = { value1, value2, value3 };  In this type of initialization, the values are assigned in sequential order as they are declared in the structure template.
  • 27. TYPEDEFINED STRUCTURES(TYPEDEF):  The typedef is a keyword that is used to provide existing data types with a new name.  The C typedef keyword is used to redefine the name of already existing data types.  When names of data types become difficult to use in programs, typedef is used with user-defined data types, which behave similarly to defining an alias for commands.  C typedef Syntax: typedef existing_name alias_name; After this declaration, we can use the alias_name as if it was the real existing_name in our C program.
  • 28. typedef struct { type1 member1; type2 member2; ------ ------ }typedef_structure_name; EX: typedef struct { char name[30]; int age; int rno; }student; Creating variable: typedef_name variable; Ex: student cse;
  • 29.
  • 30. UNIONS:  A union declaration is similar to a structure, but the fields of a union must share their memory space.  This means that only one field of the union is “active” at any given time. union tag_name union student { { type1 member1; char name[20]; type2 member2; int age; ------ int rno; ------ }; type_n member_n; }
  • 31. 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.
  • 32. 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]
  • 33. LISTS  Types of linked lists:  Single linked list  Doubly linked list  Single circular linked list  Doubly circular linked list
  • 34. 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).
  • 35. 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.
  • 36. 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]
  • 37. STACK  The stack can be implemented into two ways:  Using arrays (Static implementation)  Using pointer (Dynamic implementation)
  • 38. 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.
  • 39. 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
  • 40. QUEUE  The queue can be implemented into two ways:  Using arrays (Static implementation)  Using pointer (Dynamic implementation)
  • 41. 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.
  • 42. 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.
  • 43. TREES  The tree structure organizes the data into branches, which related the information. A B C D E F G root
  • 44. 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.
  • 45. 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.
  • 46. 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
  • 47. GRAPH  Types of Graphs:  Directed graph  Undirected graph  Simple graph  Weighted graph  Connected graph  Non-connected graph