Week 2
Algorithms
Sorting algorithms
Insertion sort
Analyzing algorithms
https://www.youtube.com/watch?v=koMpGeZpu4Q
Analyzing algorithms
• You should know exactly what is the input size
• Algorithm analysis is to predict its performance
• The running time of an algorithm is the num of
primitive operations to be executed
• Our goal is to find the effect of changing input
size on the execution time (growth rate)
Apply on the insertion sort
Break
Examples
• loop
• nested loop
• nested loop from i
• nested loop (constant inner)
• two loops one after another
Any Questions ??
Thanks

Problem solving (programming) 2