Time Complexities
No description yet. This curated deck is ready for daily study.
Card preview (7)
What is Constant time complexity?
• O (1) • Time is independent of input • Example: Determining if a number is odd / even.
What is Linear time complexity?
• O (n) • Worst case scenario: must go through each item once. • Example: Linear search
What is Polynomial time complexity?
• O (n²) • A loop inside a loop • Example: Bubble sort
What is a Logarithmic time complexity?
• O (logn) • Halves the number of items in each iteration • Example: Binary search
What is a Linear Logarithmic time complexity?
• O (nlogn) • N / A • Example: Merge sort
What is an Exponential time complexity?
• O (2^n) • Intractable • Example: Recursively calculating Fibonacci numbers
What is a Factorial time complexity?
• O (n!) • Intractable • Example: Travelers problem