0% found this document useful (0 votes)
200 views1 page

Big O Notes

This document summarizes common Big O time complexities and their definitions: O(1) represents constant time, O(log n) is logarithmic time, O(n) is linear time, O(n log n) is linearithmic time, and O(n^2) is polynomial time. It also defines the Omega, Theta, and Big O notations for describing the best, average, and worst case time complexities of algorithms. Non-dominant terms and constants are dropped when simplifying Big O expressions.

Uploaded by

timbouma6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
200 views1 page

Big O Notes

This document summarizes common Big O time complexities and their definitions: O(1) represents constant time, O(log n) is logarithmic time, O(n) is linear time, O(n log n) is linearithmic time, and O(n^2) is polynomial time. It also defines the Omega, Theta, and Big O notations for describing the best, average, and worst case time complexities of algorithms. Non-dominant terms and constants are dropped when simplifying Big O expressions.

Uploaded by

timbouma6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Big O Basic Concepts:

• O(1): Constant Time


• Doesn't depend on the size of the data set.
• Example: Accessing an array element by its index.
• O(log n): Logarithmic Time
• Splits the data in each step (divide and conquer).
• Example: Binary search.
• O(n): Linear Time
• Directly proportional to the data set size.
• Example: Looping through an array.
• O(n log n): Linearithmic Time
• Splits and sorts or searches data.
• Example: Merge sort, quick sort.
• O(n2): Polynomial Time
• Nested loops for each power of n.
2
• Example: Bubble sort (O(n )).

Omega (Ω) – Best Case


• What it means: Omega (Ω) describes the best-case scenario for an algorithm.
• In simple terms: It tells you the fastest an algorithm can run in the best
circumstances.

Theta (Θ) – Average Case


• In simple terms: It tells you what to generally expect in terms of time complexity.

Big O (O) - Worst Case


• What it means: Big O (O) describes the worst-case scenario for an algorithm.
• In simple terms: It tells you the slowest an algorithm can run in the worst
circumstances.

Other Concepts:
• Drop Non-Dominant Terms
2 2
• In O(n + n), focus on O(n ) as it will dominate for large n.
• Drop Constants
• O(2n) simplifies to O(n).

You might also like