Lecture 3. Growth of Functions Asymptotic Notation
Lecture 3. Growth of Functions Asymptotic Notation
CT065-3-3
Assessing Algorithmic
Performance And Correctness
Level 3 – Computing (Software Engineering)
Topic and Structure of the Lesson
1. Running-time of algorithms
2. Kinds of performance analyses
3. Asymptotic Analysis
4. Analysis of Insertion and Merge Sort
5. Correctness of algorithms
6. Group Exercise
- Analysis of Selection Sort
- Q&A on correctness of algorithms
Module Code and Module Title Title of Slides Slide 2 (of 26)
Learning Outcomes
Module Code and Module Title Title of Slides Slide 3 (of 26)
Key Terms
1. Asymptote
2. Big O(O)
3. Theta(Θ)
4. Omega(Ω)
Module Code and Module Title Title of Slides Slide 4 (of 26)
Running Time of Algorithms
• The running time of an algorithm can be
indicative of its efficient implementation (slide
14, Lecture 1)
• For example, the Merge Sort had a faster
running time as n increased than Insertion and
Selection sort.
• Running time depends on the input: an already
sorted sequence is easier to sort!
• We generally seek upper bounds on the running
time, because we want a guarantee that the
algorithm will run within a certain time frame.
Module Code and Module Title Title of Slides Slide 5 (of 26)
Kinds of Performance Analyses
Worse-case: (usually)
• T(n) = maximum time of algorithm on any input
of size n.
Average-case: (sometimes)
• T(n) = expected time of algorithm over all
inputs of size n.
• Need assumption of statistical distribution of
inputs
Best-case: (bogus)
• Cheat with a slow algorithm that works fast on
some input.
Module Code and Module Title Title of Slides Slide 6 (of 26)
Asymptotic Analysis