SlideShare a Scribd company logo
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 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
kavitha muneeshwaran
 
State Machine Diagram
State Machine DiagramState Machine Diagram
State Machine Diagram
Niloy Rocker
 
Matching techniques
Matching techniquesMatching techniques
Matching techniques
Nagpalkirti
 
Tema2 modelo entidad relación
Tema2   modelo entidad relaciónTema2   modelo entidad relación
Tema2 modelo entidad relación
Alvaro Loustau
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
Shishir Aryal
 
Interaction Modeling
Interaction ModelingInteraction Modeling
Interaction Modeling
Hemant Sharma
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
Tony Nguyen
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
Nishant Munjal
 
Hospital Management system Database design
Hospital Management system Database designHospital Management system Database design
Hospital Management system Database design
Elias Dinsa
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
Shakila Mahjabin
 
Object diagram
Object diagramObject diagram
Object diagram
Rahul Pola
 
Database Keys
Database KeysDatabase Keys
Database Keys
Forrester High School
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
KristinaBorooah
 
data modeling and models
data modeling and modelsdata modeling and models
data modeling and models
sabah N
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
Saurabh Kumar
 
Data Modeling PPT
Data Modeling PPTData Modeling PPT
Data Modeling PPT
Trinath
 
Hypothesis Testing With Python
Hypothesis Testing With PythonHypothesis Testing With Python
Hypothesis Testing With Python
Mosky Liu
 
The database applications
The database applicationsThe database applications
The database applications
Dolat Ram
 
Collaboration diagram- UML diagram
Collaboration diagram- UML diagram Collaboration diagram- UML diagram
Collaboration diagram- UML diagram
Ramakant Soni
 
System model.Chapter One(GEOFFREY GORDON)
System model.Chapter One(GEOFFREY GORDON)System model.Chapter One(GEOFFREY GORDON)
System model.Chapter One(GEOFFREY GORDON)
Towfiq218
 

What's hot (20)

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
 
State Machine Diagram
State Machine DiagramState Machine Diagram
State Machine Diagram
 
Matching techniques
Matching techniquesMatching techniques
Matching techniques
 
Tema2 modelo entidad relación
Tema2   modelo entidad relaciónTema2   modelo entidad relación
Tema2 modelo entidad relación
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
 
Interaction Modeling
Interaction ModelingInteraction Modeling
Interaction Modeling
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Hospital Management system Database design
Hospital Management system Database designHospital Management system Database design
Hospital Management system Database design
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Object diagram
Object diagramObject diagram
Object diagram
 
Database Keys
Database KeysDatabase Keys
Database Keys
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
 
data modeling and models
data modeling and modelsdata modeling and models
data modeling and models
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
 
Data Modeling PPT
Data Modeling PPTData Modeling PPT
Data Modeling PPT
 
Hypothesis Testing With Python
Hypothesis Testing With PythonHypothesis Testing With Python
Hypothesis Testing With Python
 
The database applications
The database applicationsThe database applications
The database applications
 
Collaboration diagram- UML diagram
Collaboration diagram- UML diagram Collaboration diagram- UML diagram
Collaboration diagram- UML diagram
 
System model.Chapter One(GEOFFREY GORDON)
System model.Chapter One(GEOFFREY GORDON)System model.Chapter One(GEOFFREY GORDON)
System model.Chapter One(GEOFFREY GORDON)
 

Similar to Data Structure and Algorithms –Introduction.pptx

Lecture 1 and 2
Lecture 1 and 2Lecture 1 and 2
Lecture 1 and 2
SaheedTundeZubairSTA
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
JohnStuart83
 
Advance data structure
Advance data structureAdvance data structure
Advance data structure
ashok kumar
 
RAJAT PROJECT.pptx
RAJAT PROJECT.pptxRAJAT PROJECT.pptx
RAJAT PROJECT.pptx
SayedMohdAsim2
 
Data structures - Introduction
Data structures - IntroductionData structures - Introduction
Data structures - Introduction
DeepaThirumurugan
 
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
karymadelaneyrenne19
 
Data Structures in C
Data Structures in CData Structures in C
Data Structures in C
Jabs6
 
CSE 443 (1).pptx
CSE 443 (1).pptxCSE 443 (1).pptx
CSE 443 (1).pptx
JayaKrishna636858
 
Data Structure.pptx
Data Structure.pptxData Structure.pptx
Data Structure.pptx
SajalFayyaz
 
project on data structures and algorithm
project on data structures and algorithmproject on data structures and algorithm
project on data structures and algorithm
AnujKumar566766
 
Data structure introduction
Data structure introductionData structure introduction
Data structure introduction
NavneetSandhu0
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
Trupti Agrawal
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
saranyatdr
 
Csallner algorithms1
Csallner algorithms1Csallner algorithms1
Csallner algorithms1
seshagiri rao
 
Data Structures & Algorithms
Data Structures & AlgorithmsData Structures & Algorithms
Data Structures & Algorithms
Muhammad Jahanzaib
 
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
wilsonchandiga1
 
Ds
DsDs
Data Structures- Part1 overview and review
Data Structures- Part1 overview and reviewData Structures- Part1 overview and review
Data Structures- Part1 overview and review
Abdullah 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-4
sumitbardhan
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
Abdul salam
 

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
 
project on data structures and algorithm
project on data structures and algorithmproject on data structures and algorithm
project on data structures and algorithm
 
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
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
 
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.
 

Recently uploaded

basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEMTIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
HODECEDSIET
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
enizeyimana36
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 

Recently uploaded (20)

basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEMTIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 

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