SlideShare a Scribd company logo
INTRODUCTION TO ALGORITHM
Prepared by
R. Gomthijayam
Asst. Prof. of CA
Algorithms
• The word algorithm comes from the name of a Persian
mathematician Abu Ja’far Mohammed ibn-i Musa al
Khowarizmi.
• In computer science, this word refers to a special method
useable by a computer for solution of a problem. The
statement of the problem specifies in general terms the
desired input/output relationship.
• For example, sorting a given sequence of numbers into
nondecreasing order provides fertile ground for introducing
many standard design techniques and analysis tools.
The problem of sorting
Asymptotic Notation
The notation we use to describe the asymptotic running time
of an algorithm are defined in terms of functions whose
domains are the set of natural numbers
 ...,2,1,0N
O-notation
• For a given function , we denote by the set of
functions
• We use O-notation to give an asymptotic upper bound of a
function, to within a constant factor.
• means that there existes some constant c s.t.
is always for large enough n.
)(ng ))(( ngO








0
0
allfor)()(0
s.t.andconstantspositiveexistthere:)(
))((
nnncgnf
ncnf
ngO
))(()( ngOnf 
)(ncg)(nf
Ω-Omega notation
• For a given function , we denote by the set of
functions
• We use Ω-notation to give an asymptotic lower bound on a
function, to within a constant factor.
• means that there exists some constant c s.t.
is always for large enough n.
)(ng ))(( ng








0
0
allfor)()(0
s.t.andconstantspositiveexistthere:)(
))((
nnnfncg
ncnf
ng
))(()( ngnf 
)(nf )(ncg
-Theta notation
• For a given function , we denote by the set of
functions
• A function belongs to the set if there exist
positive constants and such that it can be “sand- wiched”
between and or sufficienly large n.
• means that there exists some constant c1 and c2
s.t. for large enough n.
)(ng ))(( ng








021
021
allfor)()()(c0
s.t.and,,constantspositiveexistthere:)(
))((
nnngcnfng
nccnf
ng
)(nf ))(( ng
1c 2c
)(1 ngc )(2 ngc
Θ
))(()( ngnf 
)()()( 21 ngcnfngc 
Standard notations and common functions
• Logarithms:
)lg(lglglg
)(loglog
logln
loglg 2
nn
nn
nn
nn
kk
e




Standard notations and common functions
• Factorials
For the Stirling approximation:



















ne
n
nn
n
1
12!
0n
)lg()!lg(
)2(!
)(!
nnn
n
non
n
n



Performance Measurement Needs
 programming language
 working program
 computer
 compiler and options to use
javac -o

More Related Content

PPTX
Analysis of algorithn class 3
PPT
Asymptotic notation
PPT
Asymptoptic notations
PPTX
Lec 5 asymptotic notations and recurrences
PPTX
Asymptotic notation
PPT
Asymptotic notations
PPTX
Asymptotic notations
PPTX
asymptotic analysis and insertion sort analysis
Analysis of algorithn class 3
Asymptotic notation
Asymptoptic notations
Lec 5 asymptotic notations and recurrences
Asymptotic notation
Asymptotic notations
Asymptotic notations
asymptotic analysis and insertion sort analysis

What's hot (20)

PPTX
Asymptotic notations
PPT
Asymptotic Notation
PDF
PDF
Asymptotic Notation
PPT
Asymptotic Notation and Complexity
PPT
Asymptotic analysis
PPTX
Asymptotic analysis
PPTX
Asymptotics 140510003721-phpapp02
PPTX
Algorithm big o
PDF
Asymptotic
PPT
Complexity of Algorithm
PDF
Reconstruction
PPTX
Computational Complexity
PPT
Algorithm.ppt
PDF
Lecture 4 asymptotic notations
PPTX
Asymptotic notations(Big O, Omega, Theta )
PPT
Algorithmic Notations
PDF
Complexity
PPTX
Lecture 5: Asymptotic analysis of algorithms
PPT
Introducción al Análisis y diseño de algoritmos
Asymptotic notations
Asymptotic Notation
Asymptotic Notation
Asymptotic Notation and Complexity
Asymptotic analysis
Asymptotic analysis
Asymptotics 140510003721-phpapp02
Algorithm big o
Asymptotic
Complexity of Algorithm
Reconstruction
Computational Complexity
Algorithm.ppt
Lecture 4 asymptotic notations
Asymptotic notations(Big O, Omega, Theta )
Algorithmic Notations
Complexity
Lecture 5: Asymptotic analysis of algorithms
Introducción al Análisis y diseño de algoritmos
Ad

Similar to Introducction to Algorithm (20)

PPT
Algorithm
PPT
Algorithm
PPT
Algorithm in Computer, Sorting and Notations
PPTX
Asymptotic Notations.pptx
PPT
algorithm_lec_1eregdsgdfgdgdfgdfgdfg.ppt
PPTX
Algorithm analysis and design
PPTX
Asymptotic notations ada
PPTX
Asymptotic Notations
PDF
Anlysis and design of algorithms part 1
PDF
Unit 1_final DESIGN AND ANALYSIS OF ALGORITHM.pdf
PPT
Asymptotic Analysis.ppt
PPTX
Lec 2 algorithms efficiency complexity
PPTX
Intro to super. advance algorithm..pptx
PPTX
02 Introduction to Data Structures & Algorithms.pptx
PDF
DSA
PPT
Data Structures- Part2 analysis tools
PPTX
Unit ii algorithm
PPTX
complexity big oh notation notation.pptx
PPTX
Design and Analysis of Algorithms Lecture Notes
Algorithm
Algorithm
Algorithm in Computer, Sorting and Notations
Asymptotic Notations.pptx
algorithm_lec_1eregdsgdfgdgdfgdfgdfg.ppt
Algorithm analysis and design
Asymptotic notations ada
Asymptotic Notations
Anlysis and design of algorithms part 1
Unit 1_final DESIGN AND ANALYSIS OF ALGORITHM.pdf
Asymptotic Analysis.ppt
Lec 2 algorithms efficiency complexity
Intro to super. advance algorithm..pptx
02 Introduction to Data Structures & Algorithms.pptx
DSA
Data Structures- Part2 analysis tools
Unit ii algorithm
complexity big oh notation notation.pptx
Design and Analysis of Algorithms Lecture Notes
Ad

More from Rajamanickam Gomathijayam (9)

PPTX
Computer Application in Business
PDF
PPTX
Coding for php with mysql
PPTX
Php with mysql ppt
PPTX
Corel Draw Introduction
PPTX
Introduction to computer graphics
PDF
Artificial Intelligence
PDF
Network Concepts
Computer Application in Business
Coding for php with mysql
Php with mysql ppt
Corel Draw Introduction
Introduction to computer graphics
Artificial Intelligence
Network Concepts

Recently uploaded (20)

PDF
Anesthesia in Laparoscopic Surgery in India
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Pharma ospi slides which help in ospi learning
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Classroom Observation Tools for Teachers
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Lesson notes of climatology university.
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
Anesthesia in Laparoscopic Surgery in India
O7-L3 Supply Chain Operations - ICLT Program
Pharma ospi slides which help in ospi learning
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPH.pptx obstetrics and gynecology in nursing
Module 4: Burden of Disease Tutorial Slides S2 2025
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
102 student loan defaulters named and shamed – Is someone you know on the list?
Abdominal Access Techniques with Prof. Dr. R K Mishra
Final Presentation General Medicine 03-08-2024.pptx
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Microbial diseases, their pathogenesis and prophylaxis
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Classroom Observation Tools for Teachers
Sports Quiz easy sports quiz sports quiz
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Computing-Curriculum for Schools in Ghana
Lesson notes of climatology university.
Renaissance Architecture: A Journey from Faith to Humanism
2.FourierTransform-ShortQuestionswithAnswers.pdf

Introducction to Algorithm

  • 1. INTRODUCTION TO ALGORITHM Prepared by R. Gomthijayam Asst. Prof. of CA
  • 2. Algorithms • The word algorithm comes from the name of a Persian mathematician Abu Ja’far Mohammed ibn-i Musa al Khowarizmi. • In computer science, this word refers to a special method useable by a computer for solution of a problem. The statement of the problem specifies in general terms the desired input/output relationship. • For example, sorting a given sequence of numbers into nondecreasing order provides fertile ground for introducing many standard design techniques and analysis tools.
  • 3. The problem of sorting
  • 4. Asymptotic Notation The notation we use to describe the asymptotic running time of an algorithm are defined in terms of functions whose domains are the set of natural numbers  ...,2,1,0N
  • 5. O-notation • For a given function , we denote by the set of functions • We use O-notation to give an asymptotic upper bound of a function, to within a constant factor. • means that there existes some constant c s.t. is always for large enough n. )(ng ))(( ngO         0 0 allfor)()(0 s.t.andconstantspositiveexistthere:)( ))(( nnncgnf ncnf ngO ))(()( ngOnf  )(ncg)(nf
  • 6. Ω-Omega notation • For a given function , we denote by the set of functions • We use Ω-notation to give an asymptotic lower bound on a function, to within a constant factor. • means that there exists some constant c s.t. is always for large enough n. )(ng ))(( ng         0 0 allfor)()(0 s.t.andconstantspositiveexistthere:)( ))(( nnnfncg ncnf ng ))(()( ngnf  )(nf )(ncg
  • 7. -Theta notation • For a given function , we denote by the set of functions • A function belongs to the set if there exist positive constants and such that it can be “sand- wiched” between and or sufficienly large n. • means that there exists some constant c1 and c2 s.t. for large enough n. )(ng ))(( ng         021 021 allfor)()()(c0 s.t.and,,constantspositiveexistthere:)( ))(( nnngcnfng nccnf ng )(nf ))(( ng 1c 2c )(1 ngc )(2 ngc Θ ))(()( ngnf  )()()( 21 ngcnfngc 
  • 8. Standard notations and common functions • Logarithms: )lg(lglglg )(loglog logln loglg 2 nn nn nn nn kk e    
  • 9. Standard notations and common functions • Factorials For the Stirling approximation:                    ne n nn n 1 12! 0n )lg()!lg( )2(! )(! nnn n non n n   
  • 10. Performance Measurement Needs  programming language  working program  computer  compiler and options to use javac -o