Algorithm Design and
Analysis
This presentation covers algorithm basics and performance. It
provides a clear overview of key concepts. Time and space
complexity will be discussed. Asymptotic notations will also be
covered. Finally, we'll cover recursion vs iteration.
by Riju Majumdar
Time and Space Complexity
Time Complexity Space Complexity
Time complexity measures the time an algorithm takes. Space complexity measures the memory used by an
It's a function of the input size. algorithm. This includes input data and auxiliary space.
Example: Searching an element in an array. Example: Storing a matrix in memory.
Asymptotic Notations
1 Big O Notation 2 Big Omega Notation
Describes the upper Describes the lower
bound of an algorithm's bound. It represents the
growth rate. It indicates best-case scenario.
the worst-case scenario.
3 Theta Notation
Describes the tight bound. It provides both upper and lower bounds.
Visualizing Asymptotic Behavior
Input Size Big O Big Omega Theta
The chart visually represents the growth rates of Big O, Big Omega, and Theta notations as the input size increases. It helps to understand how algorithms scale wit
Time Complexity Cases
Best Case Worst Case Average Case
Minimum time to Maximum time to Average time to
complete execution. complete execution. complete execution.
Searching first Searching last Searching random
element in a list. element in a list. element in a list.
Recursion vs. Iteration
Recursion
Function calls itself until a base case is reached.
Elegant for some problems.
Iteration
Uses loops to repeat a set of instructions. More
efficient in some cases.
Examples
Factorial calculation can be done using both methods.
Each has tradeoffs.