SlideShare a Scribd company logo
1 of 17
DATA STRUCTURE AND
ALGORITHMS –INTRODUCTION
Anu Prabha R S
Faculty Associates
Department of CSA
What is data
structure?
A data structure is a particular way of
organizing data in a computer so that it
can be used effectively.
For example, we can store a list of
items having the same data-type using
the array data structure.
In some cases, a data structure can become the underlying implementation for a
particular data type.
For example, composite data types are data structures that are composed of primitive
data types and/or other composite types, whereas an abstract data type will define a
set of behaviours (almost like an ‘interface’ in a sense) for which a particular data
structure can be used as the concrete implementation for that data type.
We can categorize the data structures into two categories
linear and non linear data structures
Types of Data structure
In linear data structures, the elements are arranged in
sequence one after the other. Since elements are
arranged in particular order, they are easy to implement.
However, when the complexity of the program
increases, the linear data structures might not be the
best choice because of operational complexities.
Unlike linear data structures, elements in non-linear
data structures are not in any sequence. Instead, they
are arranged in a hierarchical manner where one
element will be connected to one or more elements.
Linear Data Structures Non-Linear Data Structures
The data items are arranged in sequential order,
one after the other.
The data items are arranged in non-sequential
order (hierarchical manner).
All the items are present on the single layer. The data items are present at different layers.
It can be traversed on a single run. That is, if we
start from the first element, we can traverse all
the elements sequentially in a single pass.
It requires multiple runs. That is, if we start from
the first element it might not be possible to
traverse all the elements in a single pass.
The memory utilization is not efficient.
Different structures utilize memory in different
efficient ways depending on the need.
The time complexity increase with the data size. Time complexity remains the same.
Example: Arrays, Stack, Queue Example: Tree, Graph, Map
What is an
Algorithm????
The word algorithm comes from the name of
Persian author “Abu Jafar Mohammad ibn Musa al
Khawarizmi ”.
Outline , An essence of a computational procedure,
step by step process.
An Algorithm is a finite sequence of instructions,
each of which has a clear meaning and can be
performed with a finite amount of effort in a finite
length of time.
No matter what the input values may be, an
algorithm terminates after executing a finite
number of instructions.​
Algorithm describes the actions on input instances.
Characteristics of An Algorithm
Unambiguous :Algorithm should be clear and unambiguous. Each of its
steps (or phases), and their inputs/outputs should be clear and must lead
to only one meaning.
Input :An algorithm should have 1 or more well-defined outputs and
should match the desired output.
Output :An algorithm should have 1 or more well-defined outputs and
should match the desired output.
Finiteness :Algorithms must terminate after a finite number of steps.
Feasibility :Should be feasible with the available resources.
Independent :An algorithm should have step-by-step directions, which
should be independent of any programming code.
Qualities of Good
Algorithms
Input and output should be defined
precisely.
Each step in the algorithm should
be clear and unambiguous.
Algorithms should be most effective
among many different ways to solve
a problem.
An algorithm shouldn't include
computer code. Instead, the
algorithm should be written in
such a way that it can be used in
different programming languages.
An algorithm to add two numbers and
display the result.
step 1 − START ADD
step 2 − get values of a & b
step 3 − c ← a + b
step 4 − display c
step 5 − STOP
An Example of a
Simple Algorithm
Fundamentals of
Algorithmic Problem
Solving
Pseudocode
Pseudocode is a notation system for
writing algorithms.
The pseudocode notation specifies
operations that a machine can
perform in as human-friendly (e.g.,
easy to read) way as possible, while
avoiding ambiguity.
A mixture of natural language and high-level programming
concepts that describes the main ideas behind a general
implementation of a data structure or algorithm.
It is more structured than usual prose but less formal than
programming language
PSEUDOCODE
CONVENTIONS
:
1. Give a valid name for the pseudo-code procedure. (See
sample code for insertion sort at the end)
2. Use proper Indentation for every statement in a block
structure.
3.Use the line numbers for each line of code.
4. For a flow control statements use if else. Always end an if
statement with an end-if. Both if, else and end-if should be
aligned vertically in same line.
Ex:
If (conditional expression)
statements (see the indentation)
else
statements
end-if
5. Use “=” or “← ” operator for assignment statements.
Ex:
i = j or I ← j
n = 2 to length[A] or
n ← 2 to length[A] .
6. Array elements can be represented by specifying the
array name followed by the index in square brackets.
For example,
A[i] indicates the ith element of the array A.
7. For looping or iteration use for or while statements.
Always end a for loop with end for and a while with end-
while.
8. The conditional expression of for or while can be written
as shown in rule (4).
PSEUDOCODE
CONVENTIONS
Sample pseudo-code for insertion sort using
the above conventions:
• INSERTION-SORT(A)
1. for j ← 2 to length[A]
2. key ← A[j]
3. I ← j – 1
4. while i > 0 and A[i] < key // If
required, use this convention for a
comment
5. A[i+1] ← A[i] // Swap two elements of
array.
6. i ← i –1
7. end-while
8. A[i+1] ← key
9. end-for

More Related Content

What's hot

Data structure power point presentation
Data structure power point presentation Data structure power point presentation
Data structure power point presentation Anil Kumar Prajapati
 
The fundamentals of Machine Learning
The fundamentals of Machine LearningThe fundamentals of Machine Learning
The fundamentals of Machine LearningHichem Felouat
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithmrajkumar1631010038
 
Address calculation-sort
Address calculation-sortAddress calculation-sort
Address calculation-sortVasim Pathan
 
Data Integration and Transformation in Data mining
Data Integration and Transformation in Data miningData Integration and Transformation in Data mining
Data Integration and Transformation in Data miningkavitha muneeshwaran
 
Algorithm And analysis Lecture 03& 04-time complexity.
 Algorithm And analysis Lecture 03& 04-time complexity. Algorithm And analysis Lecture 03& 04-time complexity.
Algorithm And analysis Lecture 03& 04-time complexity.Tariq Khan
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
Array data structure
Array data structureArray data structure
Array data structuremaamir farooq
 
Data Structure and Algorithms
Data Structure and Algorithms Data Structure and Algorithms
Data Structure and Algorithms ManishPrajapati78
 
AIML 7th semester VTU
AIML 7th semester VTUAIML 7th semester VTU
AIML 7th semester VTUAyushiLodha3
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventionssaranyatdr
 
Lecture 5 Decision tree.pdf
Lecture 5 Decision tree.pdfLecture 5 Decision tree.pdf
Lecture 5 Decision tree.pdfssuser4c50a9
 
Supervised and unsupervised learning
Supervised and unsupervised learningSupervised and unsupervised learning
Supervised and unsupervised learningParas Kohli
 

What's hot (20)

Data structure power point presentation
Data structure power point presentation Data structure power point presentation
Data structure power point presentation
 
The fundamentals of Machine Learning
The fundamentals of Machine LearningThe fundamentals of Machine Learning
The fundamentals of Machine Learning
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
Address calculation-sort
Address calculation-sortAddress calculation-sort
Address calculation-sort
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
 
Data Integration and Transformation in Data mining
Data Integration and Transformation in Data miningData Integration and Transformation in Data mining
Data Integration and Transformation in Data mining
 
Algorithm And analysis Lecture 03& 04-time complexity.
 Algorithm And analysis Lecture 03& 04-time complexity. Algorithm And analysis Lecture 03& 04-time complexity.
Algorithm And analysis Lecture 03& 04-time complexity.
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Types of algorithms
Types of algorithmsTypes of algorithms
Types of algorithms
 
Array data structure
Array data structureArray data structure
Array data structure
 
Data Structure and Algorithms
Data Structure and Algorithms Data Structure and Algorithms
Data Structure and Algorithms
 
Unit 1 chapter 1 Design and Analysis of Algorithms
Unit 1   chapter 1 Design and Analysis of AlgorithmsUnit 1   chapter 1 Design and Analysis of Algorithms
Unit 1 chapter 1 Design and Analysis of Algorithms
 
Time andspacecomplexity
Time andspacecomplexityTime andspacecomplexity
Time andspacecomplexity
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
Introduction to Algorithm
Introduction to AlgorithmIntroduction to Algorithm
Introduction to Algorithm
 
AIML 7th semester VTU
AIML 7th semester VTUAIML 7th semester VTU
AIML 7th semester VTU
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
 
Lecture 5 Decision tree.pdf
Lecture 5 Decision tree.pdfLecture 5 Decision tree.pdf
Lecture 5 Decision tree.pdf
 
Symbol Table
Symbol TableSymbol Table
Symbol Table
 
Supervised and unsupervised learning
Supervised and unsupervised learningSupervised and unsupervised learning
Supervised and unsupervised learning
 

Similar to Data Structure and Algorithms –Introduction.pptx

Advance data structure
Advance data structureAdvance data structure
Advance data structureashok kumar
 
Data structures - Introduction
Data structures - IntroductionData structures - Introduction
Data structures - IntroductionDeepaThirumurugan
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfkarymadelaneyrenne19
 
Data Structures in C
Data Structures in CData Structures in C
Data Structures in CJabs6
 
Data Structure.pptx
Data Structure.pptxData Structure.pptx
Data Structure.pptxSajalFayyaz
 
Data structure introduction
Data structure introductionData structure introduction
Data structure introductionNavneetSandhu0
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithmTrupti Agrawal
 
Csallner algorithms1
Csallner algorithms1Csallner algorithms1
Csallner algorithms1seshagiri rao
 
Discussion forum unit 6 - Software Engineering 2.docx
Discussion forum unit 6 - Software Engineering 2.docxDiscussion forum unit 6 - Software Engineering 2.docx
Discussion forum unit 6 - Software Engineering 2.docxwilsonchandiga1
 
Data Structures- Part1 overview and review
Data Structures- Part1 overview and reviewData Structures- Part1 overview and review
Data Structures- Part1 overview and reviewAbdullah Al-hazmy
 
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4sumitbardhan
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm. Abdul salam
 
ADSA orientation.pptx
ADSA orientation.pptxADSA orientation.pptx
ADSA orientation.pptxKiran Babar
 
0-IntroductionToDSA.ppt
0-IntroductionToDSA.ppt0-IntroductionToDSA.ppt
0-IntroductionToDSA.pptTrnHuy921814
 

Similar to Data Structure and Algorithms –Introduction.pptx (20)

Lecture 1 and 2
Lecture 1 and 2Lecture 1 and 2
Lecture 1 and 2
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Advance data structure
Advance data structureAdvance data structure
Advance data structure
 
RAJAT PROJECT.pptx
RAJAT PROJECT.pptxRAJAT PROJECT.pptx
RAJAT PROJECT.pptx
 
Data structures - Introduction
Data structures - IntroductionData structures - Introduction
Data structures - Introduction
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
 
Data Structures in C
Data Structures in CData Structures in C
Data Structures in C
 
CSE 443 (1).pptx
CSE 443 (1).pptxCSE 443 (1).pptx
CSE 443 (1).pptx
 
Data Structure.pptx
Data Structure.pptxData Structure.pptx
Data Structure.pptx
 
Data structure introduction
Data structure introductionData structure introduction
Data structure introduction
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
 
Csallner algorithms1
Csallner algorithms1Csallner algorithms1
Csallner algorithms1
 
Data Structures & Algorithms
Data Structures & AlgorithmsData Structures & Algorithms
Data Structures & Algorithms
 
Discussion forum unit 6 - Software Engineering 2.docx
Discussion forum unit 6 - Software Engineering 2.docxDiscussion forum unit 6 - Software Engineering 2.docx
Discussion forum unit 6 - Software Engineering 2.docx
 
Ds
DsDs
Ds
 
Data Structures- Part1 overview and review
Data Structures- Part1 overview and reviewData Structures- Part1 overview and review
Data Structures- Part1 overview and review
 
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
358 33 powerpoint-slides_4-introduction-data-structures_chapter-4
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
 
ADSA orientation.pptx
ADSA orientation.pptxADSA orientation.pptx
ADSA orientation.pptx
 
0-IntroductionToDSA.ppt
0-IntroductionToDSA.ppt0-IntroductionToDSA.ppt
0-IntroductionToDSA.ppt
 

Recently uploaded

Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
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
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
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
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
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
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
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
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
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
 

Recently uploaded (20)

Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
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
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
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
 
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
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
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...
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
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
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
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
 

Data Structure and Algorithms –Introduction.pptx

  • 1. DATA STRUCTURE AND ALGORITHMS –INTRODUCTION Anu Prabha R S Faculty Associates Department of CSA
  • 2. What is data structure? A data structure is a particular way of organizing data in a computer so that it can be used effectively. For example, we can store a list of items having the same data-type using the array data structure.
  • 3. In some cases, a data structure can become the underlying implementation for a particular data type. For example, composite data types are data structures that are composed of primitive data types and/or other composite types, whereas an abstract data type will define a set of behaviours (almost like an ‘interface’ in a sense) for which a particular data structure can be used as the concrete implementation for that data type. We can categorize the data structures into two categories linear and non linear data structures
  • 4. Types of Data structure
  • 5. In linear data structures, the elements are arranged in sequence one after the other. Since elements are arranged in particular order, they are easy to implement. However, when the complexity of the program increases, the linear data structures might not be the best choice because of operational complexities. Unlike linear data structures, elements in non-linear data structures are not in any sequence. Instead, they are arranged in a hierarchical manner where one element will be connected to one or more elements.
  • 6. Linear Data Structures Non-Linear Data Structures The data items are arranged in sequential order, one after the other. The data items are arranged in non-sequential order (hierarchical manner). All the items are present on the single layer. The data items are present at different layers. It can be traversed on a single run. That is, if we start from the first element, we can traverse all the elements sequentially in a single pass. It requires multiple runs. That is, if we start from the first element it might not be possible to traverse all the elements in a single pass. The memory utilization is not efficient. Different structures utilize memory in different efficient ways depending on the need. The time complexity increase with the data size. Time complexity remains the same. Example: Arrays, Stack, Queue Example: Tree, Graph, Map
  • 7. What is an Algorithm???? The word algorithm comes from the name of Persian author “Abu Jafar Mohammad ibn Musa al Khawarizmi ”. Outline , An essence of a computational procedure, step by step process. An Algorithm is a finite sequence of instructions, each of which has a clear meaning and can be performed with a finite amount of effort in a finite length of time. No matter what the input values may be, an algorithm terminates after executing a finite number of instructions.​ Algorithm describes the actions on input instances.
  • 8.
  • 9. Characteristics of An Algorithm Unambiguous :Algorithm should be clear and unambiguous. Each of its steps (or phases), and their inputs/outputs should be clear and must lead to only one meaning. Input :An algorithm should have 1 or more well-defined outputs and should match the desired output. Output :An algorithm should have 1 or more well-defined outputs and should match the desired output. Finiteness :Algorithms must terminate after a finite number of steps. Feasibility :Should be feasible with the available resources. Independent :An algorithm should have step-by-step directions, which should be independent of any programming code.
  • 10. Qualities of Good Algorithms Input and output should be defined precisely. Each step in the algorithm should be clear and unambiguous. Algorithms should be most effective among many different ways to solve a problem. An algorithm shouldn't include computer code. Instead, the algorithm should be written in such a way that it can be used in different programming languages.
  • 11. An algorithm to add two numbers and display the result. step 1 − START ADD step 2 − get values of a & b step 3 − c ← a + b step 4 − display c step 5 − STOP An Example of a Simple Algorithm
  • 13. Pseudocode Pseudocode is a notation system for writing algorithms. The pseudocode notation specifies operations that a machine can perform in as human-friendly (e.g., easy to read) way as possible, while avoiding ambiguity.
  • 14. A mixture of natural language and high-level programming concepts that describes the main ideas behind a general implementation of a data structure or algorithm. It is more structured than usual prose but less formal than programming language
  • 15. PSEUDOCODE CONVENTIONS : 1. Give a valid name for the pseudo-code procedure. (See sample code for insertion sort at the end) 2. Use proper Indentation for every statement in a block structure. 3.Use the line numbers for each line of code. 4. For a flow control statements use if else. Always end an if statement with an end-if. Both if, else and end-if should be aligned vertically in same line. Ex: If (conditional expression) statements (see the indentation) else statements end-if
  • 16. 5. Use “=” or “← ” operator for assignment statements. Ex: i = j or I ← j n = 2 to length[A] or n ← 2 to length[A] . 6. Array elements can be represented by specifying the array name followed by the index in square brackets. For example, A[i] indicates the ith element of the array A. 7. For looping or iteration use for or while statements. Always end a for loop with end for and a while with end- while. 8. The conditional expression of for or while can be written as shown in rule (4). PSEUDOCODE CONVENTIONS
  • 17. Sample pseudo-code for insertion sort using the above conventions: • INSERTION-SORT(A) 1. for j ← 2 to length[A] 2. key ← A[j] 3. I ← j – 1 4. while i > 0 and A[i] < key // If required, use this convention for a comment 5. A[i+1] ← A[i] // Swap two elements of array. 6. i ← i –1 7. end-while 8. A[i+1] ← key 9. end-for