0
0
Data Structures Theoryknowledge~5 mins

Time complexity (Big O notation) in Data Structures Theory - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Big O notation?
Big O notation is a way to describe how the time or space needed by an algorithm grows as the input size grows. It helps us understand the efficiency of algorithms.
Click to reveal answer
beginner
What does O(1) time complexity mean?
O(1) means the algorithm takes the same amount of time to run, no matter how big the input is. This is called constant time.
Click to reveal answer
intermediate
Explain the difference between O(n) and O(n²) time complexity.
O(n) means the time grows linearly with input size. O(n²) means the time grows much faster, roughly the square of the input size, which is slower for large inputs.
Click to reveal answer
intermediate
Why do we ignore constants and lower order terms in Big O notation?
Because Big O focuses on how the algorithm behaves as input grows very large, constants and smaller terms become less important and don't affect the overall growth rate.
Click to reveal answer
beginner
Give a real-life example to understand O(log n) time complexity.
Searching for a word in a dictionary by opening it in the middle and deciding which half to look next is like O(log n). Each step cuts the search space in half, making it very efficient.
Click to reveal answer
Which of the following represents the fastest growing time complexity?
AO(n²)
BO(log n)
CO(1)
DO(n)
What does O(n) mean in terms of algorithm performance?
ATime grows exponentially
BTime stays constant regardless of input
CTime grows linearly with input size
DTime grows logarithmically
Why do we use Big O notation?
ATo measure exact running time in seconds
BTo describe how an algorithm scales with input size
CTo count the number of lines in code
DTo find bugs in the program
Which time complexity is better for large inputs?
AO(n²)
BO(n log n)
CO(n)
DO(1)
If an algorithm takes 5n + 10 steps, what is its Big O notation?
AO(n)
BO(5n + 10)
CO(10)
DO(n²)
Explain in your own words what Big O notation tells us about an algorithm.
Think about how time changes when input gets bigger.
You got /4 concepts.
    Describe a real-life example that helps you understand O(log n) time complexity.
    Consider how you find a word in a phone book or dictionary.
    You got /3 concepts.