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.
Data Structure and Algorithms –Introduction.pptx
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

PDF
COA-QUESTION-BANK.pdf
PPTX
Computer system organization
PDF
Production System in AI
PPTX
Issues in knowledge representation
PPTX
Client server model
PPTX
Introduction to computer architecture and organization
PPTX
Case study operating systems
PPTX
5. phase of nlp
COA-QUESTION-BANK.pdf
Computer system organization
Production System in AI
Issues in knowledge representation
Client server model
Introduction to computer architecture and organization
Case study operating systems
5. phase of nlp

What's hot (20)

PPTX
Advanced DBMS presentation
PPTX
Fuzzy arithmetic
DOCX
Emergingtreands class11 cs
PPTX
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
PDF
Expert systems Artificial Intelligence
PPTX
PPTX
Classification and Regression
PPTX
Insertion operation in array(ds)
PDF
Instruction code
PPTX
HCI Unit 3.pptx
PDF
Bresenham line-drawing-algorithm By S L Sonawane.pdf
PDF
project ppt.pdf
PPT
Computer Organization and Assembly Language
PPTX
Bcd and ascii arithmetic instructions
PPTX
Tree and graph
PPTX
Adaptive Resonance Theory
PPTX
Hacking & Hackers
PPT
ADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtap
PDF
Hazards in pipeline
Advanced DBMS presentation
Fuzzy arithmetic
Emergingtreands class11 cs
COMPUTER INSTRUCTIONS & TIMING & CONTROL.
Expert systems Artificial Intelligence
Classification and Regression
Insertion operation in array(ds)
Instruction code
HCI Unit 3.pptx
Bresenham line-drawing-algorithm By S L Sonawane.pdf
project ppt.pdf
Computer Organization and Assembly Language
Bcd and ascii arithmetic instructions
Tree and graph
Adaptive Resonance Theory
Hacking & Hackers
ADVANCE DATABASE MANAGEMENT SYSTEM CONCEPTS & ARCHITECTURE by vikas jagtap
Hazards in pipeline
Ad

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

PPTX
Introduction to data structures and its types
PPTX
Lecture 1 and 2
PPT
Introduction of C++ Text book UNIT-1 .ppt
PPTX
UNIT 1.pptx
PPTX
UNIT 1 Memory ManagementMemory Management.pptx
DOC
Advance data structure
PPTX
RAJAT PROJECT.pptx
PPTX
Data structures - Introduction
PDF
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
PPTX
Data Structures in C
PPTX
CSE 443 (1).pptx
PPTX
Data Structure.pptx
PPTX
project on data structures and algorithm
PPTX
Data structure introduction
PPTX
Data structure and algorithm
DOCX
3rd-Sem_CSE_Data-Structures and Applications.docx
PDF
Unit-I PPT hususi sisooshsgv. Eijeieieooekejj
PPTX
Algorithm and pseudocode conventions
PDF
Csallner algorithms1
PDF
data base nd analystics slybysss for the students to improbvr
Introduction to data structures and its types
Lecture 1 and 2
Introduction of C++ Text book UNIT-1 .ppt
UNIT 1.pptx
UNIT 1 Memory ManagementMemory Management.pptx
Advance data structure
RAJAT PROJECT.pptx
Data structures - Introduction
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Data Structures in C
CSE 443 (1).pptx
Data Structure.pptx
project on data structures and algorithm
Data structure introduction
Data structure and algorithm
3rd-Sem_CSE_Data-Structures and Applications.docx
Unit-I PPT hususi sisooshsgv. Eijeieieooekejj
Algorithm and pseudocode conventions
Csallner algorithms1
data base nd analystics slybysss for the students to improbvr
Ad

Recently uploaded (20)

PPTX
Construction Project Organization Group 2.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
DOCX
573137875-Attendance-Management-System-original
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Geodesy 1.pptx...............................................
PPTX
additive manufacturing of ss316l using mig welding
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
composite construction of structures.pdf
Construction Project Organization Group 2.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Foundation to blockchain - A guide to Blockchain Tech
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Model Code of Practice - Construction Work - 21102022 .pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
573137875-Attendance-Management-System-original
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Geodesy 1.pptx...............................................
additive manufacturing of ss316l using mig welding
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
composite construction of structures.pdf

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.
  • 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