Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Time

Complexity
Data Structures and Algorithms
What is an
Algorithm?
What is an Algorithm?

A set of well-defined instructions for solving a specific


problem.
How do we
measure
performance?
How do we measure performance?

+ Time?
+ Processor?
+ Storage?
Which is faster?

OR
Big-O

+ Also known as Big-O Notation


+ Represents algorithm’s worst-case complexity
+ Measures the efficiency and performance of an algorithm
using Time and Space complexity
Time and Space Complexity

+ Indicates how long it would take for an algorithm to


execute as a function of its input size.
https://www.bigocheatsheet.com/
O(1) - Constant
https://replit.com/@jabernardo/BigO-Constant
O(n) - Linear
https://replit.com/@jabernardo/BigO-Linear
2
O(n ) - Quadratic
https://replit.com/@jabernardo/BigO-Quadratic
O(log n) - Logarithmic
https://replit.com/@jabernardo/BigO-Logarithmic
O(n log n) -Quasilinear
https://replit.com/@jabernardo/BigO-Quasilinear
O(n log n) -Quasilinear
https://replit.com/@jabernardo/BigO-Quasilinear2
O(n!) -Exponential
https://replit.com/@jabernardo/BigO-Quasilinear2

You might also like