Big O Notations Flashcards
What are the Asymptotic Notation types?
Big O
Big Theta Θ
Big Omega Ω
What is the root meaning of Asymptotic?
The word asymptotic stems from the Greek root meaning “not falling together”. In ancient Greek mathematics the conic sections studied where deemed hyperbolas such as a graph where y = x and y = -x. The lines of both y values of x and -x curved lines on the graphs approach each other but never touch when x ➜ ∞.
O(1) space complexity denotes?
The amount of memory used is constant and is not dependent on data processing.
Which line on the graph represents constant time?
Line A (green line)
Which line represents logarithmic time complexity?
Line B (yellow line)
Which line represents linear time complexity?
Line c (blue line)
Which line represents quadratic time complexity?
Line d (red line)
Algorithms that are said to take the same amount of time executed are called?
Constant time algorithms
If the execution time of this algorithm is independent of the size of input, it is considered why type of complexity?
O(1) Constant Time
What type of complexity is an algorithm if the time to execute is directly proportional to the input size?
O(n) Linear Time Complexity
Binary search is an example of which time complexity?
O(log n) Logarithmic Time Complexity
What time complexity is the time it takes to run an algorithm is proportional to the logarithm of the input size n?
O(Log n) Logarithmic Time Complexity
What time complexity is an algorithm if the time to execution is proportional to the square of the input size?
O(n^2) Quadratic Time Complexity
Checking to see whether there are any duplicates in a deck of cards is an example of which time complexity?
O(n^2) Quadratic Time Complexity
Algorithms involving nested iterations such as nested loops are which type of time complexity?
O(n^2) Quadratic Time Complexity
Bubble sort is an example of which time complexity?
O(n^2) Quadratic Time Complexity
Selection sort is an example of which time complexity?
O(n^2) Quadratic Time Complexity
Insertion sort is an example of which time complexity?
O(n^2) Quadratic Time Complexity
Accessing arrays on average has which time and space complexity?
Time = Θ(1)
Space worst case = O(n)
Searching arrays, on average, has which time and space complexity?
Time average: Θ(n)
Space worst: O(n)
Array insertion, on average, has which time and space complexity?
Time average: Θ(n)
Space worst: O(n)
Array deletion, on average, has which time and space complexity?
Time average: Θ(n)
Space worst: O(n)
What is the best time complexity and the worst space complexity for array quicksort algorithms?
Time best: Ω(n log(n))
Space worst: O(log(n))
What is the best time complexity and the worst space complexity for array mergesort algorithms?
Time best: Ω(n log(n))
Space worst: O(n)
What is the best time complexity and the worst space complexity for array Timsort algorithms?
Time best: Ω(n)
Space worst: O(n)
What is the best time complexity and the worst space complexity for array heapsort algorithms?
Time best: Ω(n log(n))
Space worst: O(1)
What is the best time complexity and the worst space complexity for array bubble sort algorithms?
Time best: Ω(n)
Space worst: O(1)
What is the best time complexity and the worst space complexity for array insertion sort algorithms?
Time best: Ω(n)
Space worst: O(1)
What is the best time complexity and the worst space complexity for array selection sort algorithms?
Time best: Ω(n^2)
Space worst: O(1)
What is the best time complexity and the worst space complexity for array tree sort algorithms?
Time best: Ω(n log(n))
Space worst: O(n)
What is the best time complexity and the worst space complexity for array shell sort algorithms?
Time best: Ω(n log(n))
Space worst: O(1)
What is the best time complexity and the worst space complexity for array bucket sort algorithms?
Time best: Ω(n + k)
Space worst: O(n)
What is the best time complexity and the worst space complexity for array radix sort algorithms?
Time best: Ω(nk)
Space worst: O(n + k)
What is the best time complexity and the worst space complexity for array counting sort algorithms?
Time best: Ω(n + k)
Space worst: O(k)
What is the best time complexity and the worst space complexity for array cube sort algorithms?
Time best: Ω(n)
Space worst: O(n)
What is the average time complexity and the worst space complexity for stack access algorithms?
Time average: Θ(n)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Queue access algorithms?
Time average: Θ(n)
Space worst: O(n)
What is the average time complexity and the worst space complexity for stack search algorithms?
Time average: Θ(n)
Space worst: O(n)
What is the average time complexity and the worst space complexity for stack insertion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for stack deletion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Queue insertion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Queue deletion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Singly-Linked Lists access algorithms?
Time average: Θ(n)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Doubly-Linked Lists access algorithms?
Time average: Θ(n)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Singly-Linked Lists search algorithms?
Time average: Θ(n)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Doubly-Linked Lists search algorithms?
Time average: Θ(n)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Singly-Linked Lists insertion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Doubly-Linked Lists insertion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Singly-Linked Lists deletion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Doubly-Linked Lists deletion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Skip List access algorithms?
Time average: Θ(log(n))
Space worst: O(n log(n))
What is the average time complexity and the worst space complexity for Skip List search algorithms?
Time average: Θ(log(n))
Space worst: O(n log(n))
What is the average time complexity and the worst space complexity for Skip List insertion algorithms?
Time average: Θ(log(n))
Space worst: O(n log(n))
What is the average time complexity and the worst space complexity for Skip List deletion algorithms?
Time average: Θ(log(n))
Space worst: O(n log(n))
What is the average time complexity and the worst space complexity for Hash Table search algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Hash Table insertion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Hash Table deletion algorithms?
Time average: Θ(1)
Space worst: O(n)
What is the average time complexity and the worst space complexity for Binary Search Tree access algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Binary Search Tree search algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Binary Search Tree deletion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Binary Search Tree insertion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Cartesian Tree search algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for B-Tree access algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for B-Tree search algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Cartesian Tree insertion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Cartesian Tree deletion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for B-Tree insertion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for B-Tree deletion algorithms?
Time average: Θlog (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Red-Black Tree search algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Red-Black Tree access algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Red-Black Tree insertion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Red-Black Tree deletion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Splay Tree search algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Splay Tree insertion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for Splay Tree deletion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for AVL Tree access algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for AVL Tree search algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for AVL Tree insertion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for AVL Tree deletion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for KD Tree access algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for KD Tree search algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for KD Tree insertion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the average time complexity and the worst space complexity for KD Tree deletion algorithms?
Time average: Θ(log (n))
Space worst: O(n)
What is the Big O time complexity when you have a loop within a loop?
a.) O(1)
b.) O(n^2)
c.) O(log n)
d.) O(n)
b.) O(n^2)
How would the following be written: O(100n^2)
a.) O(100n)
b.) O(n^100)
c.) O(n^2)
d.) O(2n^100)
c.) O(n^2)
We drop the constant.
What Big O is associated with Divide and Conquer?
a.) O(1)
b.) O(log n)
c.) O(n^2)
d.) O(n)
b.) O(log n)
O(log n) is divide and conquer.
What is the correct way to write: O(n^2 + n) ?
a.) O(n^3)
b.) O(3n)
c.) O(n^2)
d.) O(n + n^2)
c.) O(n^2)
We drop the non-dominants.
The most efficient Big O is:
a.) O(1)
b.) O(n^2)
c.) O(log n)
d.) O(n)
a.) O(1)
O(1) is known as constant time.