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)