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)

PDF
Cs8391 notes rejinpaul
Dharmaraj Prof and Head CSE Coimbatore
 
PDF
01VD062009003760042.pdf
SunilMatsagar1
 
PDF
251 - Alogarithms Lects.pdf
Abdulkadir Jibril
 
PDF
Design and Analysis Algorithms.pdf
HarshNagda5
 
PDF
Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...
Rohit Dubey
 
PDF
Compiler gate question key
ArthyR3
 
PPTX
Algorithmics, intro to data structures.pptx
OntopScenes
 
PPT
chapter 1
yatheesha
 
PPTX
London F-Sharp User Group : Don Syme on F# - 09/09/2010
Skills Matter
 
PPT
python workshop(one of the 15 chapters)
Mehul shah
 
PPT
L01 intro-daa - ppt1
sankaran L
 
PPTX
introductiontodatascience-230122140841-b90a0856 (1).pptx
urvashipundir04
 
PPTX
FDS_dept_ppt.pptx
SatyajitPatil42
 
PDF
1.1 the introduction of design and analysis of algorithm
Mohammed khaja Jamaluddin
 
PPTX
Metrics for project size estimation
Nur Islam
 
PPTX
Programming str_Language of Logic/c.pptx
MsKGowriDhilipkumar
 
PPTX
Bootcamp_AIAppsUCSD.pptx
Object Automation
 
PDF
Bootcamp_AIApps.pdf
Object Automation
 
PDF
Bootcamp_AIApps.pdf
Object Automation
 
PPT
Data Structures and Algorithm Analysis
Mary Margarat
 
01VD062009003760042.pdf
SunilMatsagar1
 
251 - Alogarithms Lects.pdf
Abdulkadir Jibril
 
Design and Analysis Algorithms.pdf
HarshNagda5
 
Data Science Job ready #DataScienceInterview Question and Answers 2022 | #Dat...
Rohit Dubey
 
Compiler gate question key
ArthyR3
 
Algorithmics, intro to data structures.pptx
OntopScenes
 
chapter 1
yatheesha
 
London F-Sharp User Group : Don Syme on F# - 09/09/2010
Skills Matter
 
python workshop(one of the 15 chapters)
Mehul shah
 
L01 intro-daa - ppt1
sankaran L
 
introductiontodatascience-230122140841-b90a0856 (1).pptx
urvashipundir04
 
FDS_dept_ppt.pptx
SatyajitPatil42
 
1.1 the introduction of design and analysis of algorithm
Mohammed khaja Jamaluddin
 
Metrics for project size estimation
Nur Islam
 
Programming str_Language of Logic/c.pptx
MsKGowriDhilipkumar
 
Bootcamp_AIAppsUCSD.pptx
Object Automation
 
Bootcamp_AIApps.pdf
Object Automation
 
Bootcamp_AIApps.pdf
Object Automation
 
Data Structures and Algorithm Analysis
Mary Margarat
 

Recently uploaded (20)

PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PDF
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
community health nursing question paper 2.pdf
Prince kumar
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
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?