SlideShare a Scribd company logo
1 of 23
Download to read offline
d l hData Structures and Algorithms 
Lab(MC501)Lab(MC501) 
Dr. Sudhan Majhi
fAssistant Professor
smajhi@iitp.ac.in
Why Data Structures?Why Data Structures?
P bl l i i l t d tProblem solving is more related to
understanding the problem, designing a
solution and implementing the solution.
What exactly is a solution?What exactly is a solution?
In a very crisp way, it can be demonstrate as a
solution which is equal to a program and it issolution which is equal to a program and it is
also approximately equal to algorithm.
2
House  structure of data 
Furniture  DataFurniture  Data 
Data StructureData Structure 
A data structure is a scheme for organizing data in theA data structure is a scheme for organizing data in the 
memory of a computer. 
Some of the more commonly used data structures 
include lists, arrays, stacks, queues, heaps, trees, and 
graphsgraphs.
The way in which the data is organized affects the y g
performance of a program for different tasks.
Computer programmers decide which data structuresComputer programmers decide which data structures 
to use based on the nature of the data and the processes 
that need to be performed on that data.that need to be performed on that data.
AlgorithmAlgorithm
An algorithm is a sequence of steps that take us from theAn algorithm is a sequence of steps that take us from the
input to the output.
An algorithm must be Correct. It should provide a correct
solution according to the specificationssolution according to the specifications.
Finite It should terminate and generalFinite, It should terminate and general.
It should work for every instance of a problem is efficient.
5
It should use few resources (such as time or memory).
List & ArraysList & Arrays
SyllabusSyllabus
 List&Arrays  Stacks ShortingList&Arrays
‐Consisting of a 
collection 
of elements
‐Allow insertions and 
removals only at 
top of stack(LIFO)
Shorting
‐Arranging data in 
some given order
of elements top of stack(LIFO)
Queue
All i ti t
•Searching
‐Finding the
Recursion
‐Allow insertions at 
the back and removals 
from the front  (FIFO)
Finding the 
location of a given 
item
‐Is the process of 
repeating items in 
a self‐similar way
Linked Lists Trees
Graphs and their 
Application Linked Lists 
‐Allow insertions and removals 
anywhere 
‐ High‐speed searching and 
sorting of data and efficient 
elimination of duplicate data 
items
OutlineOutline
i• List 
• Arraysy
• Arrays vs Lists
• Application of arrays• Application of arrays 
• Sum of arrays 
• Multidimensional arrays  
• Sum of MatrixSum of Matrix 
• Multiplication of Matrix 
ListList
List of students in M.Tech batch 2013
1. Amal
2. Kamal
3. Anil
4. Kartheek ( after withdrew) 
5. Mahesh
Fi l Li t f t d t i M T h b t h 2013Final List of students in M.Tech batch 2013
1. Amal
2 Kamal2. Kamal
3. Anil
4. Mahesh
ArraysArrays
An array is a data structure consisting of a collectiony g
of elements (values or variables), each identified by
at least one array index or key.y y
a= 3         8         9         0       2       6         9         3       7
a[0]     a[1]    a[2]    a[3]  a[4]  a[ 5]   a[6]    a[7]   a[8][ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]
Index i=3Index i=3
a[i] equals to 0
If i=4 then a[i] equals to 2 and so on 
Arrays (cont’d)Arrays (cont d)
 A i i d d f i bl h An array is an indexed set of variables, such as  
dancer[1], dancer[2], dancer[3],… It is like a set of [ ] [ ] [ ]
boxes that hold things. 
 A list is a set of items.
 An array is a set of
variables that each 
store an item.
Arrays vs ListsArrays vs Lists
You can see the difference between arrays andYou can see the difference between arrays and 
lists when you delete items.
In a list, the missing spot is filled in when 
something is deleted.something is deleted.
Applications of ArraysApplications of Arrays
Without arrays, we cannot think implement anything inWithout arrays, we cannot think implement anything in 
computer. 
To represent discrete mathematics, we required array. 
Information theory bioinformatics coding theoryInformation theory, bioinformatics, coding theory. 
 l d lImage processing, signal processing and wireless 
communications. 
Sum of arraysSum of arrays
a= 3         8         9         0       2       6         9         3       7
a[0] a[1] a[2] a[3] a[4] a[ 5] a[6] a[7] a[8]a[0]     a[1]    a[2]    a[3]  a[4]  a[ 5]   a[6]    a[7]   a[8]
sum a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]sum=a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]
If the index is very large , let say i=1000000,  then we 
need to write all the elements in a programneed to write all the elements in a program.  
Sum of arraysSum of arrays
sum=0;sum 0;
sum=sum+a[0]
sum=sum+a[1]
sum=sum+a[i], i=0 to 8
sum sum+a[1]
sum=sum+a[2]
Programming Algorithm g
1. Set sum=0;
2. Set i =0;
Sum=0
for (i=0;i<9;i++)2. Set i 0;
3. Sum=sum+a[i];
4. i=i+1;
5 Go to line 3 if i lesser than 9
( )
{
sum=sum+a[i]
}
5. Go to line 3 if i lesser than 9
6. Print sum
scanf(“%d”,sum)
Multidimensional arraysMultidimensional arrays 
Two dimensional arrays
Column
0
Column
2
Column
3
Column
4
Column
1
Column represents by j
Row 0
[1][3]Row 1 a[1][3]
Row 2
Row represents by i Column wise reading Row wise readingp y
for{i=0;i<3;i++}
{ for{j=0;j<5;j++}
{ a[i][j]
Column wise reading  Row wise reading 
for{j=0;j<5;j++}
{for{i=0;i<3;i++}
{a[i][j]{ a[i][j]
}
}
{a[i][j]
}
}
Sum of MatricesSum of Matrices 
a[0][0] a[0][1] a[0][2] a[0][3] a[0][4] b[0][0] b[0][1] b[0][2] b[0][ 3] b[0][4]
B
a[0][0] a[0][1] a[0][2] a[0][3] a[0][4]
a[1][0] a[1][1] a[1][2] a[1][3] a[1][4]
b[0][0] b[0][1] b[0][2] b[0][ 3] b[0][4]
b[1][0] b[1][1] b[1][2] b[1][3] b[1][4]
A
a[2][0] a[2][1] a[2][2] a[2][3] a[2][4] b[2][0] b[2][1] b[2][2] b[2][3] b[2][4]
Algorithm:
i=0, j=0  i=0, j=1  i=0, j=2 i=0, j=3  i=0, j=4 
Int c[3,5]
For(i=0;i<3;i++)
{
g
a[0][0]+
b[0][0]
a[0][1]+
b[0][1]
a[0][2]+
b[0][2]
a[0][3]+ 
b[0][3]
a[0][4]+
b[0][4]
{
For(j=0;j<5;j++)
{
c[i][j]=a[i][j]+b[i][j]
i=1, j=0 i=1, j=1  i=1, j=2 i=1, j=3  i=1, j=4 
a[1][0]+ a[1][1]+ a[1][2]+ [1][3] [1][4]
c[i][j] a[i][j] b[i][j]
}
}
a[1][0]+
b[1][0]
a[1][1]+
b[1][1]
a[1][2]+
b[1][2]
a[1][3]+
b[1][3]
a[1][4]+
b[1][4]
Multiplication of MatricesMultiplication of Matrices 
a[0][0] a[0][1] a[0][2] a[0][3] a[0][4] b[0][0] b[0][1] b[0][2]
a[1][0] a[1][1] a[1][2] a[1][3] a[1][4] b[1][0] b[1][1] b[1][2]A
B
a[2][0] a[2][1] a[2][2] a[2][3] a[2][4] b[2][0] b[2][1] b[2][2]
b[3][0] B[3][1] b[3][2]
Sum=0
Code for multiplication
b[4][0] B[4][1] B[4][2]For(k=0;k<3;k++)
For(l=0;l<3;l++)
For(i=0;i<5;i++)
sum=sum+a[l][i]*b[i][l]
}
c[k][l]=sum
0sum=0
}
}
Multiplication of MatricesMultiplication of Matrices 
k=0, l=0, i=0 to 4
c[0][0] a[0][0] a[0][1] a[0][2] a[0][3] a[0][4] b[0][0]
b[1][0]
Al orithm
C
b[2][0]
b[3][0]
Algorithm
Sum=0
For(k=0;k<3;k++)
C b[3][0]
b[4][0]
For(k 0;k<3;k++)
For(l=0;l<3;l++)
For(i=0;i<5;i++)
sum=sum+a[l][i]*b[i][l][ ][ ] [ ][ ]
}
c[k][l]=sum
sum=0
}
}
Multiplication of MatricesMultiplication of Matrices 
k=0, l=1, i=0 to 4
c[0][0] c[0][1] a[1][0] a[0][1] a[0][2] a[0][3] a[0][4] b[0][1]
b[1][1]
b[2][1]
l i h
C
b[2][1]
b[3][1]
Algorithm
Sum=0
For(k=0;k<3;k++)
C
b[4][1]
For(k=0;k<3;k++)
For(l=0;l<3;l++)
For(i=0;i<5;i++)
sum=sum+a[l][i]*b[i][l]sum sum+a[l][i] b[i][l]
}
c[k][l]=sum
sum=0
}
}
Multiplication of MatricesMultiplication of Matrices 
K=1, l=0, i=0 to 4
[0][0] [0][1] [0][2]
a[1][0] a[1][1] a[1][2] a[1][3] a[1][4] b[0][0]
c[0][0] c[0][1] c[0][2]
c[1][0]
b[1][0]
Al i h b[2][0]
b[3][0]
Algorithm
Sum=0
For(k=0;k<3;k++)
C
b[3][0]
b[4][0]
For(k 0;k<3;k++)
For(l=0;l<3;l++)
For(i=0;i<5;i++)
sum=sum+a[l][i]*b[i][l][ ][ ] [ ][ ]
}
c[k][l]=sum
sum=0
}
}
SummarySummary
List vs AarryList  vs Aarry
Sum=0
Sum of array  Sum of Matrices Product of Matrices
Int c[3,5] Sum=0
F (k 0 k 3 k )for (i=0;i<9;i++)
{
sum=sum+a[i]
[ ]
For(i=0;i<3;i++)
{
For(j=0;j<5;j++)
For(k=0;k<3;k++)
For(l=0;l<3;l++)
For(i=0;i<5;i++)
sum sum+a[l][i]*b[i][l]}
scanf(“%d”,sum)
{
c[i][j]=a[i][j]+b[i][j]
}
sum=sum+a[l][i]*b[i][l]
}
c[k][l]=sum
sum=0
22
}
sum=0
}
}
h kThanks

More Related Content

What's hot

8. Graph - Data Structures using C++ by Varsha Patil
8. Graph - Data Structures using C++ by Varsha Patil8. Graph - Data Structures using C++ by Varsha Patil
8. Graph - Data Structures using C++ by Varsha Patilwidespreadpromotion
 
Introduction of Data Structure
Introduction of Data StructureIntroduction of Data Structure
Introduction of Data StructureMandavi Classes
 
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patilwidespreadpromotion
 
How to handling strings in r
How to handling strings in rHow to handling strings in r
How to handling strings in rPramod Rathore
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURERohit Rai
 
R Regression Models with Zelig
R Regression Models with ZeligR Regression Models with Zelig
R Regression Models with Zeligizahn
 
Introduction To Data Structures.
Introduction To Data Structures.Introduction To Data Structures.
Introduction To Data Structures.Education Front
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithmsVinayKumarV16
 
16. Algo analysis & Design - Data Structures using C++ by Varsha Patil
16. Algo analysis & Design - Data Structures using C++ by Varsha Patil16. Algo analysis & Design - Data Structures using C++ by Varsha Patil
16. Algo analysis & Design - Data Structures using C++ by Varsha Patilwidespreadpromotion
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceTransweb Global Inc
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsAakash deep Singhal
 
Sequential & binary, linear search
Sequential & binary, linear searchSequential & binary, linear search
Sequential & binary, linear searchmontazur420
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)Arvind Devaraj
 
Ii pu cs practical viva voce questions
Ii pu cs  practical viva voce questionsIi pu cs  practical viva voce questions
Ii pu cs practical viva voce questionsProf. Dr. K. Adisesha
 
Tree representation in map reduce world
Tree representation  in map reduce worldTree representation  in map reduce world
Tree representation in map reduce worldYu Liu
 

What's hot (20)

M v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notesM v bramhananda reddy dsa complete notes
M v bramhananda reddy dsa complete notes
 
8. Graph - Data Structures using C++ by Varsha Patil
8. Graph - Data Structures using C++ by Varsha Patil8. Graph - Data Structures using C++ by Varsha Patil
8. Graph - Data Structures using C++ by Varsha Patil
 
Array
ArrayArray
Array
 
Introduction of Data Structure
Introduction of Data StructureIntroduction of Data Structure
Introduction of Data Structure
 
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil13. Indexing MTrees - Data Structures using C++ by Varsha Patil
13. Indexing MTrees - Data Structures using C++ by Varsha Patil
 
How to handling strings in r
How to handling strings in rHow to handling strings in r
How to handling strings in r
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
R Regression Models with Zelig
R Regression Models with ZeligR Regression Models with Zelig
R Regression Models with Zelig
 
Introduction To Data Structures.
Introduction To Data Structures.Introduction To Data Structures.
Introduction To Data Structures.
 
Introduction of data structures and algorithms
Introduction of data structures and algorithmsIntroduction of data structures and algorithms
Introduction of data structures and algorithms
 
Data Mining
Data MiningData Mining
Data Mining
 
16. Algo analysis & Design - Data Structures using C++ by Varsha Patil
16. Algo analysis & Design - Data Structures using C++ by Varsha Patil16. Algo analysis & Design - Data Structures using C++ by Varsha Patil
16. Algo analysis & Design - Data Structures using C++ by Varsha Patil
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
 
Data Structures
Data StructuresData Structures
Data Structures
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithmsLecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
 
Sequential & binary, linear search
Sequential & binary, linear searchSequential & binary, linear search
Sequential & binary, linear search
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)
 
Ii pu cs practical viva voce questions
Ii pu cs  practical viva voce questionsIi pu cs  practical viva voce questions
Ii pu cs practical viva voce questions
 
Data types in r
Data types in rData types in r
Data types in r
 
Tree representation in map reduce world
Tree representation  in map reduce worldTree representation  in map reduce world
Tree representation in map reduce world
 

Similar to DSA Lab Overview

Mca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureMca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureRai University
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureRai University
 
Data structures "1" (Lectures 2015-2016)
Data structures "1" (Lectures 2015-2016) Data structures "1" (Lectures 2015-2016)
Data structures "1" (Lectures 2015-2016) Ameer B. Alaasam
 
Data structure and algorithm notes
Data structure and algorithm notesData structure and algorithm notes
Data structure and algorithm notessuman khadka
 
Data Structures unit I Introduction - data types
Data Structures unit I Introduction - data typesData Structures unit I Introduction - data types
Data Structures unit I Introduction - data typesAmirthaVarshini80
 
Lecture 1 IntroductionToDataStructures_coursematerial_Draft0.01.ppt
Lecture 1 IntroductionToDataStructures_coursematerial_Draft0.01.pptLecture 1 IntroductionToDataStructures_coursematerial_Draft0.01.ppt
Lecture 1 IntroductionToDataStructures_coursematerial_Draft0.01.pptiamsallauddin
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfAxmedcarb
 
DATA STRUCTURE BY SIVASANKARI
DATA STRUCTURE BY SIVASANKARIDATA STRUCTURE BY SIVASANKARI
DATA STRUCTURE BY SIVASANKARISivaSankari36
 
Array 2 hina
Array 2 hina Array 2 hina
Array 2 hina heena94
 
DSA 1- Introduction.pdf
DSA 1- Introduction.pdfDSA 1- Introduction.pdf
DSA 1- Introduction.pdfAliyanAbbas1
 
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 Structures - Lecture 1 - Unit 1.pptx
Data Structures  - Lecture 1 - Unit 1.pptxData Structures  - Lecture 1 - Unit 1.pptx
Data Structures - Lecture 1 - Unit 1.pptxDanielNesaKumarC
 
Data structures cs301 power point slides lecture 01
Data structures   cs301 power point slides lecture 01Data structures   cs301 power point slides lecture 01
Data structures cs301 power point slides lecture 01shaziabibi5
 
India software developers conference 2013 Bangalore
India software developers conference 2013 BangaloreIndia software developers conference 2013 Bangalore
India software developers conference 2013 BangaloreSatnam Singh
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxII B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxsabithabanu83
 

Similar to DSA Lab Overview (20)

Mca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureMca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structure
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structure
 
Data structures "1" (Lectures 2015-2016)
Data structures "1" (Lectures 2015-2016) Data structures "1" (Lectures 2015-2016)
Data structures "1" (Lectures 2015-2016)
 
Data structure and algorithm notes
Data structure and algorithm notesData structure and algorithm notes
Data structure and algorithm notes
 
Data Structures unit I Introduction - data types
Data Structures unit I Introduction - data typesData Structures unit I Introduction - data types
Data Structures unit I Introduction - data types
 
Lecture 1 IntroductionToDataStructures_coursematerial_Draft0.01.ppt
Lecture 1 IntroductionToDataStructures_coursematerial_Draft0.01.pptLecture 1 IntroductionToDataStructures_coursematerial_Draft0.01.ppt
Lecture 1 IntroductionToDataStructures_coursematerial_Draft0.01.ppt
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
Array
ArrayArray
Array
 
DATA STRUCTURE BY SIVASANKARI
DATA STRUCTURE BY SIVASANKARIDATA STRUCTURE BY SIVASANKARI
DATA STRUCTURE BY SIVASANKARI
 
R training3
R training3R training3
R training3
 
Array 2 hina
Array 2 hina Array 2 hina
Array 2 hina
 
DSA 1- Introduction.pdf
DSA 1- Introduction.pdfDSA 1- Introduction.pdf
DSA 1- Introduction.pdf
 
data structures module I & II.pptx
data structures module I & II.pptxdata structures module I & II.pptx
data structures module I & II.pptx
 
Data Structures - Lecture 1 - Unit 1.pptx
Data Structures  - Lecture 1 - Unit 1.pptxData Structures  - Lecture 1 - Unit 1.pptx
Data Structures - Lecture 1 - Unit 1.pptx
 
Chapter 3 ds
Chapter 3 dsChapter 3 ds
Chapter 3 ds
 
Data structures cs301 power point slides lecture 01
Data structures   cs301 power point slides lecture 01Data structures   cs301 power point slides lecture 01
Data structures cs301 power point slides lecture 01
 
India software developers conference 2013 Bangalore
India software developers conference 2013 BangaloreIndia software developers conference 2013 Bangalore
India software developers conference 2013 Bangalore
 
R for Statistical Computing
R for Statistical ComputingR for Statistical Computing
R for Statistical Computing
 
R교육1
R교육1R교육1
R교육1
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxII B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptx
 

More from Kamal Singh Lodhi (16)

Stack Algorithm
Stack AlgorithmStack Algorithm
Stack Algorithm
 
Data Structure (MC501)
Data Structure (MC501)Data Structure (MC501)
Data Structure (MC501)
 
Cs501 trc drc
Cs501 trc drcCs501 trc drc
Cs501 trc drc
 
Cs501 transaction
Cs501 transactionCs501 transaction
Cs501 transaction
 
Cs501 rel algebra
Cs501 rel algebraCs501 rel algebra
Cs501 rel algebra
 
Cs501 mining frequentpatterns
Cs501 mining frequentpatternsCs501 mining frequentpatterns
Cs501 mining frequentpatterns
 
Cs501 intro
Cs501 introCs501 intro
Cs501 intro
 
Cs501 fd nf
Cs501 fd nfCs501 fd nf
Cs501 fd nf
 
Cs501 dm intro
Cs501 dm introCs501 dm intro
Cs501 dm intro
 
Cs501 data preprocessingdw
Cs501 data preprocessingdwCs501 data preprocessingdw
Cs501 data preprocessingdw
 
Cs501 concurrency
Cs501 concurrencyCs501 concurrency
Cs501 concurrency
 
Cs501 cluster analysis
Cs501 cluster analysisCs501 cluster analysis
Cs501 cluster analysis
 
Cs501 classification prediction
Cs501 classification predictionCs501 classification prediction
Cs501 classification prediction
 
Attribute Classification
Attribute ClassificationAttribute Classification
Attribute Classification
 
Real Time ImageVideo Processing with Applications in Face Recognition
Real Time ImageVideo Processing with  Applications in Face Recognition   Real Time ImageVideo Processing with  Applications in Face Recognition
Real Time ImageVideo Processing with Applications in Face Recognition
 
Flow diagram
Flow diagramFlow diagram
Flow diagram
 

Recently uploaded

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
(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
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
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
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
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
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 

Recently uploaded (20)

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
(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...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
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
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
★ 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
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
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...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 

DSA Lab Overview

  • 2. Why Data Structures?Why Data Structures? P bl l i i l t d tProblem solving is more related to understanding the problem, designing a solution and implementing the solution. What exactly is a solution?What exactly is a solution? In a very crisp way, it can be demonstrate as a solution which is equal to a program and it issolution which is equal to a program and it is also approximately equal to algorithm. 2
  • 4. Data StructureData Structure  A data structure is a scheme for organizing data in theA data structure is a scheme for organizing data in the  memory of a computer.  Some of the more commonly used data structures  include lists, arrays, stacks, queues, heaps, trees, and  graphsgraphs. The way in which the data is organized affects the y g performance of a program for different tasks. Computer programmers decide which data structuresComputer programmers decide which data structures  to use based on the nature of the data and the processes  that need to be performed on that data.that need to be performed on that data.
  • 5. AlgorithmAlgorithm An algorithm is a sequence of steps that take us from theAn algorithm is a sequence of steps that take us from the input to the output. An algorithm must be Correct. It should provide a correct solution according to the specificationssolution according to the specifications. Finite It should terminate and generalFinite, It should terminate and general. It should work for every instance of a problem is efficient. 5 It should use few resources (such as time or memory).
  • 7. SyllabusSyllabus  List&Arrays  Stacks ShortingList&Arrays ‐Consisting of a  collection  of elements ‐Allow insertions and  removals only at  top of stack(LIFO) Shorting ‐Arranging data in  some given order of elements top of stack(LIFO) Queue All i ti t •Searching ‐Finding the Recursion ‐Allow insertions at  the back and removals  from the front  (FIFO) Finding the  location of a given  item ‐Is the process of  repeating items in  a self‐similar way Linked Lists Trees Graphs and their  Application Linked Lists  ‐Allow insertions and removals  anywhere  ‐ High‐speed searching and  sorting of data and efficient  elimination of duplicate data  items
  • 8. OutlineOutline i• List  • Arraysy • Arrays vs Lists • Application of arrays• Application of arrays  • Sum of arrays  • Multidimensional arrays   • Sum of MatrixSum of Matrix  • Multiplication of Matrix 
  • 9. ListList List of students in M.Tech batch 2013 1. Amal 2. Kamal 3. Anil 4. Kartheek ( after withdrew)  5. Mahesh Fi l Li t f t d t i M T h b t h 2013Final List of students in M.Tech batch 2013 1. Amal 2 Kamal2. Kamal 3. Anil 4. Mahesh
  • 10. ArraysArrays An array is a data structure consisting of a collectiony g of elements (values or variables), each identified by at least one array index or key.y y a= 3         8         9         0       2       6         9         3       7 a[0]     a[1]    a[2]    a[3]  a[4]  a[ 5]   a[6]    a[7]   a[8][ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] Index i=3Index i=3 a[i] equals to 0 If i=4 then a[i] equals to 2 and so on 
  • 11. Arrays (cont’d)Arrays (cont d)  A i i d d f i bl h An array is an indexed set of variables, such as   dancer[1], dancer[2], dancer[3],… It is like a set of [ ] [ ] [ ] boxes that hold things.   A list is a set of items.  An array is a set of variables that each  store an item.
  • 12. Arrays vs ListsArrays vs Lists You can see the difference between arrays andYou can see the difference between arrays and  lists when you delete items. In a list, the missing spot is filled in when  something is deleted.something is deleted.
  • 13. Applications of ArraysApplications of Arrays Without arrays, we cannot think implement anything inWithout arrays, we cannot think implement anything in  computer.  To represent discrete mathematics, we required array.  Information theory bioinformatics coding theoryInformation theory, bioinformatics, coding theory.   l d lImage processing, signal processing and wireless  communications. 
  • 14. Sum of arraysSum of arrays a= 3         8         9         0       2       6         9         3       7 a[0] a[1] a[2] a[3] a[4] a[ 5] a[6] a[7] a[8]a[0]     a[1]    a[2]    a[3]  a[4]  a[ 5]   a[6]    a[7]   a[8] sum a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]sum=a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8] If the index is very large , let say i=1000000,  then we  need to write all the elements in a programneed to write all the elements in a program.  
  • 15. Sum of arraysSum of arrays sum=0;sum 0; sum=sum+a[0] sum=sum+a[1] sum=sum+a[i], i=0 to 8 sum sum+a[1] sum=sum+a[2] Programming Algorithm g 1. Set sum=0; 2. Set i =0; Sum=0 for (i=0;i<9;i++)2. Set i 0; 3. Sum=sum+a[i]; 4. i=i+1; 5 Go to line 3 if i lesser than 9 ( ) { sum=sum+a[i] } 5. Go to line 3 if i lesser than 9 6. Print sum scanf(“%d”,sum)
  • 16. Multidimensional arraysMultidimensional arrays  Two dimensional arrays Column 0 Column 2 Column 3 Column 4 Column 1 Column represents by j Row 0 [1][3]Row 1 a[1][3] Row 2 Row represents by i Column wise reading Row wise readingp y for{i=0;i<3;i++} { for{j=0;j<5;j++} { a[i][j] Column wise reading  Row wise reading  for{j=0;j<5;j++} {for{i=0;i<3;i++} {a[i][j]{ a[i][j] } } {a[i][j] } }
  • 17. Sum of MatricesSum of Matrices  a[0][0] a[0][1] a[0][2] a[0][3] a[0][4] b[0][0] b[0][1] b[0][2] b[0][ 3] b[0][4] B a[0][0] a[0][1] a[0][2] a[0][3] a[0][4] a[1][0] a[1][1] a[1][2] a[1][3] a[1][4] b[0][0] b[0][1] b[0][2] b[0][ 3] b[0][4] b[1][0] b[1][1] b[1][2] b[1][3] b[1][4] A a[2][0] a[2][1] a[2][2] a[2][3] a[2][4] b[2][0] b[2][1] b[2][2] b[2][3] b[2][4] Algorithm: i=0, j=0  i=0, j=1  i=0, j=2 i=0, j=3  i=0, j=4  Int c[3,5] For(i=0;i<3;i++) { g a[0][0]+ b[0][0] a[0][1]+ b[0][1] a[0][2]+ b[0][2] a[0][3]+  b[0][3] a[0][4]+ b[0][4] { For(j=0;j<5;j++) { c[i][j]=a[i][j]+b[i][j] i=1, j=0 i=1, j=1  i=1, j=2 i=1, j=3  i=1, j=4  a[1][0]+ a[1][1]+ a[1][2]+ [1][3] [1][4] c[i][j] a[i][j] b[i][j] } } a[1][0]+ b[1][0] a[1][1]+ b[1][1] a[1][2]+ b[1][2] a[1][3]+ b[1][3] a[1][4]+ b[1][4]
  • 18. Multiplication of MatricesMultiplication of Matrices  a[0][0] a[0][1] a[0][2] a[0][3] a[0][4] b[0][0] b[0][1] b[0][2] a[1][0] a[1][1] a[1][2] a[1][3] a[1][4] b[1][0] b[1][1] b[1][2]A B a[2][0] a[2][1] a[2][2] a[2][3] a[2][4] b[2][0] b[2][1] b[2][2] b[3][0] B[3][1] b[3][2] Sum=0 Code for multiplication b[4][0] B[4][1] B[4][2]For(k=0;k<3;k++) For(l=0;l<3;l++) For(i=0;i<5;i++) sum=sum+a[l][i]*b[i][l] } c[k][l]=sum 0sum=0 } }
  • 19. Multiplication of MatricesMultiplication of Matrices  k=0, l=0, i=0 to 4 c[0][0] a[0][0] a[0][1] a[0][2] a[0][3] a[0][4] b[0][0] b[1][0] Al orithm C b[2][0] b[3][0] Algorithm Sum=0 For(k=0;k<3;k++) C b[3][0] b[4][0] For(k 0;k<3;k++) For(l=0;l<3;l++) For(i=0;i<5;i++) sum=sum+a[l][i]*b[i][l][ ][ ] [ ][ ] } c[k][l]=sum sum=0 } }
  • 20. Multiplication of MatricesMultiplication of Matrices  k=0, l=1, i=0 to 4 c[0][0] c[0][1] a[1][0] a[0][1] a[0][2] a[0][3] a[0][4] b[0][1] b[1][1] b[2][1] l i h C b[2][1] b[3][1] Algorithm Sum=0 For(k=0;k<3;k++) C b[4][1] For(k=0;k<3;k++) For(l=0;l<3;l++) For(i=0;i<5;i++) sum=sum+a[l][i]*b[i][l]sum sum+a[l][i] b[i][l] } c[k][l]=sum sum=0 } }
  • 21. Multiplication of MatricesMultiplication of Matrices  K=1, l=0, i=0 to 4 [0][0] [0][1] [0][2] a[1][0] a[1][1] a[1][2] a[1][3] a[1][4] b[0][0] c[0][0] c[0][1] c[0][2] c[1][0] b[1][0] Al i h b[2][0] b[3][0] Algorithm Sum=0 For(k=0;k<3;k++) C b[3][0] b[4][0] For(k 0;k<3;k++) For(l=0;l<3;l++) For(i=0;i<5;i++) sum=sum+a[l][i]*b[i][l][ ][ ] [ ][ ] } c[k][l]=sum sum=0 } }
  • 22. SummarySummary List vs AarryList  vs Aarry Sum=0 Sum of array  Sum of Matrices Product of Matrices Int c[3,5] Sum=0 F (k 0 k 3 k )for (i=0;i<9;i++) { sum=sum+a[i] [ ] For(i=0;i<3;i++) { For(j=0;j<5;j++) For(k=0;k<3;k++) For(l=0;l<3;l++) For(i=0;i<5;i++) sum sum+a[l][i]*b[i][l]} scanf(“%d”,sum) { c[i][j]=a[i][j]+b[i][j] } sum=sum+a[l][i]*b[i][l] } c[k][l]=sum sum=0 22 } sum=0 } }