SlideShare a Scribd company logo
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
1
S. Hassan Adelyar, Ph.D
Instructor of Computer Science Faculty
Kabul University
December 2020
Lesson I: Algorithm Analysis & Design
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
2
Course Information
 Course Name: Algorithm Analysis & Design
 Course Code: SE0601
 Credit hours: 4
 Reference: Jeffrey J. McConnell (2001). Analysis of
Algorithms: An Active Learning Approach. Jones and
Bartlett Publishers, Canada.
 Pre-requisites: Programming Fundamentals, Data
Structures and Discreet Mathematics.
 The contents of the course is divided into 16 lessons.
 Each lesson include presentation, video, quiz, &
discussion.
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
3
Learning Outcome
 By the end of this presentation, students will
be able to:
 Understand Algorithms
 Understand the design of Algorithms
 Understand flow chart & Pseudocode
 Understand the properties of Algorithms
 Understand the importance of Algorithms
 Recognize the types of Algorithms
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
4
Algorithm
 Series of Steps for solving a problem
 Set of instructions
 Transfer input to output
 Solve a specific task
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
5
Implementing Algorithms
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
6
 Example
 Sorting
 Searching
 Find Minimum
 Find Maximum
 Find shortest path between two points
 Etc.
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
7
 Algorithms can be expressed in many ways:
 Flow charts
 Pseudo-code
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
8
Flow Chart Example
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
9
Pseudo-code
p
x = 0
while (x < 25)
print x
end
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
10
Properties of Algorithm
 Finiteness
 Definiteness
 Input
 Output
 Effectiveness
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
11
Importance of Algorithm
 Algorithm as a Technology
 Processing of a large amount of data.
 Execution time is very important when
processing a large amount of input.
 Algorithms solve the same problem in
different time.
 Differences can be much more than
hardware.
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
12
 Efficiency:
 Suppose computers were infinitely fast. Would you
have any reason to study algorithm?
 Good software engineering practice.
 Select the easiest implementation.
 New application demand increase in speed.
 Time is a non-linear function of the input size.
 This can reduce their ability to benefit from the
increase in speed when the input size is large.
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
13
Examples
 Linear Search & Binary Search
 Insertion Sort, Merge Sort & Quick Sort
 Fibonacci by recursion, iteration, dynamic
approach
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
14
 The execution time of many complex
algorithms can vary due to factors other than
the size of the input.
 For example, sorting items that are already
sorted.
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
15
Factors that Affect Speed
 Problem being solved
 Programming language
 Compiler
 Computer hardware
 Programmer ability
 Algorithm
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
16
Types of algorithms
 Recursive Algorithms
 Backtracking Algorithms
 Divide-and-conquer Algorithms
 Dynamic Programming Algorithms
 Greedy Algorithms
 Brute Force Algorithms
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
17 Summary
 In this presentation, we studied Algorithms &
Algorithm design techniques.
 The presentation of Algorithm with the flowchart
& pseudocode was explained with examples.
 In addition to Algorithm, the properties of
Algorithms, importance of Algorithms & types
of Algorithms were explained
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
18
Exercises
 Write an algorithm in pseudo-code to count the
number of capital letters in a file of text. How
many comparisons does it do? What is the fewest
number of increments it might do? What is the
largest number?
 There is a set of numbers stored in a file, but we
don’t know how many it contains. Write an
algorithm in pseudo-code to calculate the average
of the numbers stored in this file. What type of
operations does your algorithm do? How many of
each of these operations does your algorithm do?
p
Introduction to Algorithms
Algorithm
Analysis
&
Design March 2020
19
 Write an algorithm to find the second largest
element in a list of N values. How many
comparisons does your algorithm do in the worst
case?
 1- Write an algorithm and draw a flowchart to
convert the length in feet to centimeter.
 2- Write an algorithm and draw a flowchart that will
read the two sides of a rectangle and calculate its
area.
p
End of Lesson 1
Question?

More Related Content

Similar to Lesson 1 - Introduction to Algorithms.pptx (20)

PPSX
Ds03 part i algorithms by jyoti lakhani
jyoti_lakhani
 
PDF
01 Revision Introduction SLides Od Design ANd Aalaysis Of aLgo
mtahanasir65
 
PDF
Lecture 2 role of algorithms in computing
jayavignesh86
 
PDF
Algorithm Analysis.pdf
NayanChandak1
 
PDF
Algorithms notes 2 tutorials duniya
TutorialsDuniya.com
 
PPTX
Algorithm in data structure bca .pptx
SukhBanger
 
PDF
Introduction to analysis algorithm in computer Science
tissandavid
 
PDF
introduction to analysis of algorithm in computer science
tissandavid
 
PPTX
Algorithm analysis (All in one)
jehan1987
 
PDF
Chapter-1-Introduction-to-Aglorithms.pdf
Shanmuganathan C
 
PPSX
Data Structure and Algorithm Chapter 1.ppsx
SolomonEndalu
 
PPTX
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
ryadavrohit26
 
PDF
Algorithms.pdf
OluwafolakeOjo
 
PPTX
Binary to hexadecimal algorithmic old.pptx
bulbul931579
 
PDF
Introduction to Algorithms Complexity Analysis
Dr. Pankaj Agarwal
 
PPT
chapter 1
yatheesha
 
PPTX
Design and analysis of algorithm lec 1.pptx
AyeshaIftikhar67
 
PDF
Design and analysis of algorithms
Dr Geetha Mohan
 
PPTX
Lecture 11234567890qwertyuiodfghjdfgh.pptx
IfraLuqman
 
PPTX
Algo_Lecture01.pptx
ShaistaRiaz4
 
Ds03 part i algorithms by jyoti lakhani
jyoti_lakhani
 
01 Revision Introduction SLides Od Design ANd Aalaysis Of aLgo
mtahanasir65
 
Lecture 2 role of algorithms in computing
jayavignesh86
 
Algorithm Analysis.pdf
NayanChandak1
 
Algorithms notes 2 tutorials duniya
TutorialsDuniya.com
 
Algorithm in data structure bca .pptx
SukhBanger
 
Introduction to analysis algorithm in computer Science
tissandavid
 
introduction to analysis of algorithm in computer science
tissandavid
 
Algorithm analysis (All in one)
jehan1987
 
Chapter-1-Introduction-to-Aglorithms.pdf
Shanmuganathan C
 
Data Structure and Algorithm Chapter 1.ppsx
SolomonEndalu
 
Modile-1-PPT-1-BCAC0207-AlgorithmDesign.pptx
ryadavrohit26
 
Algorithms.pdf
OluwafolakeOjo
 
Binary to hexadecimal algorithmic old.pptx
bulbul931579
 
Introduction to Algorithms Complexity Analysis
Dr. Pankaj Agarwal
 
chapter 1
yatheesha
 
Design and analysis of algorithm lec 1.pptx
AyeshaIftikhar67
 
Design and analysis of algorithms
Dr Geetha Mohan
 
Lecture 11234567890qwertyuiodfghjdfgh.pptx
IfraLuqman
 
Algo_Lecture01.pptx
ShaistaRiaz4
 

Recently uploaded (20)

PPTX
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
PDF
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
PPTX
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
PPTX
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
PDF
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 
PDF
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
PPTX
PLANNING A HOSPITAL AND NURSING UNIT.pptx
PRADEEP ABOTHU
 
PDF
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
PPTX
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
PDF
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
PPTX
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
PDF
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
PDF
Quiz Night Live May 2025 - Intra Pragya Online General Quiz
Pragya - UEM Kolkata Quiz Club
 
PPTX
Marketing Management PPT Unit 1 and Unit 2.pptx
Sri Ramakrishna College of Arts and science
 
PDF
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
PPTX
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
PDF
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
PPTX
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
PPTX
MATH 8 QUARTER 1 WEEK 1 LESSON 2 PRESENTATION
JohnGuillerNestalBah1
 
PDF
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
PLANNING A HOSPITAL AND NURSING UNIT.pptx
PRADEEP ABOTHU
 
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
Ward Management: Patient Care, Personnel, Equipment, and Environment.pptx
PRADEEP ABOTHU
 
Lean IP - Lecture by Dr Oliver Baldus at the MIPLM 2025
MIPLM
 
Quiz Night Live May 2025 - Intra Pragya Online General Quiz
Pragya - UEM Kolkata Quiz Club
 
Marketing Management PPT Unit 1 and Unit 2.pptx
Sri Ramakrishna College of Arts and science
 
Our Guide to the July 2025 USPS® Rate Change
Postal Advocate Inc.
 
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
MATH 8 QUARTER 1 WEEK 1 LESSON 2 PRESENTATION
JohnGuillerNestalBah1
 
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
Ad

Lesson 1 - Introduction to Algorithms.pptx

  • 1. Introduction to Algorithms Algorithm Analysis & Design March 2020 1 S. Hassan Adelyar, Ph.D Instructor of Computer Science Faculty Kabul University December 2020 Lesson I: Algorithm Analysis & Design
  • 2. Introduction to Algorithms Algorithm Analysis & Design March 2020 2 Course Information  Course Name: Algorithm Analysis & Design  Course Code: SE0601  Credit hours: 4  Reference: Jeffrey J. McConnell (2001). Analysis of Algorithms: An Active Learning Approach. Jones and Bartlett Publishers, Canada.  Pre-requisites: Programming Fundamentals, Data Structures and Discreet Mathematics.  The contents of the course is divided into 16 lessons.  Each lesson include presentation, video, quiz, & discussion. p
  • 3. Introduction to Algorithms Algorithm Analysis & Design March 2020 3 Learning Outcome  By the end of this presentation, students will be able to:  Understand Algorithms  Understand the design of Algorithms  Understand flow chart & Pseudocode  Understand the properties of Algorithms  Understand the importance of Algorithms  Recognize the types of Algorithms p
  • 4. Introduction to Algorithms Algorithm Analysis & Design March 2020 4 Algorithm  Series of Steps for solving a problem  Set of instructions  Transfer input to output  Solve a specific task p
  • 5. Introduction to Algorithms Algorithm Analysis & Design March 2020 5 Implementing Algorithms p
  • 6. Introduction to Algorithms Algorithm Analysis & Design March 2020 6  Example  Sorting  Searching  Find Minimum  Find Maximum  Find shortest path between two points  Etc. p
  • 7. Introduction to Algorithms Algorithm Analysis & Design March 2020 7  Algorithms can be expressed in many ways:  Flow charts  Pseudo-code p
  • 8. Introduction to Algorithms Algorithm Analysis & Design March 2020 8 Flow Chart Example p
  • 9. Introduction to Algorithms Algorithm Analysis & Design March 2020 9 Pseudo-code p x = 0 while (x < 25) print x end
  • 10. Introduction to Algorithms Algorithm Analysis & Design March 2020 10 Properties of Algorithm  Finiteness  Definiteness  Input  Output  Effectiveness p
  • 11. Introduction to Algorithms Algorithm Analysis & Design March 2020 11 Importance of Algorithm  Algorithm as a Technology  Processing of a large amount of data.  Execution time is very important when processing a large amount of input.  Algorithms solve the same problem in different time.  Differences can be much more than hardware. p
  • 12. Introduction to Algorithms Algorithm Analysis & Design March 2020 12  Efficiency:  Suppose computers were infinitely fast. Would you have any reason to study algorithm?  Good software engineering practice.  Select the easiest implementation.  New application demand increase in speed.  Time is a non-linear function of the input size.  This can reduce their ability to benefit from the increase in speed when the input size is large. p
  • 13. Introduction to Algorithms Algorithm Analysis & Design March 2020 13 Examples  Linear Search & Binary Search  Insertion Sort, Merge Sort & Quick Sort  Fibonacci by recursion, iteration, dynamic approach p
  • 14. Introduction to Algorithms Algorithm Analysis & Design March 2020 14  The execution time of many complex algorithms can vary due to factors other than the size of the input.  For example, sorting items that are already sorted. p
  • 15. Introduction to Algorithms Algorithm Analysis & Design March 2020 15 Factors that Affect Speed  Problem being solved  Programming language  Compiler  Computer hardware  Programmer ability  Algorithm p
  • 16. Introduction to Algorithms Algorithm Analysis & Design March 2020 16 Types of algorithms  Recursive Algorithms  Backtracking Algorithms  Divide-and-conquer Algorithms  Dynamic Programming Algorithms  Greedy Algorithms  Brute Force Algorithms p
  • 17. Introduction to Algorithms Algorithm Analysis & Design March 2020 17 Summary  In this presentation, we studied Algorithms & Algorithm design techniques.  The presentation of Algorithm with the flowchart & pseudocode was explained with examples.  In addition to Algorithm, the properties of Algorithms, importance of Algorithms & types of Algorithms were explained p
  • 18. Introduction to Algorithms Algorithm Analysis & Design March 2020 18 Exercises  Write an algorithm in pseudo-code to count the number of capital letters in a file of text. How many comparisons does it do? What is the fewest number of increments it might do? What is the largest number?  There is a set of numbers stored in a file, but we don’t know how many it contains. Write an algorithm in pseudo-code to calculate the average of the numbers stored in this file. What type of operations does your algorithm do? How many of each of these operations does your algorithm do? p
  • 19. Introduction to Algorithms Algorithm Analysis & Design March 2020 19  Write an algorithm to find the second largest element in a list of N values. How many comparisons does your algorithm do in the worst case?  1- Write an algorithm and draw a flowchart to convert the length in feet to centimeter.  2- Write an algorithm and draw a flowchart that will read the two sides of a rectangle and calculate its area. p
  • 20. End of Lesson 1 Question?