Big O Notations Flashcards

(88 cards)

1
Q

What are the Asymptotic Notation types?

A

Big O
Big Theta Θ
Big Omega Ω

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the root meaning of Asymptotic?

A

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 ➜ ∞.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

O(1) space complexity denotes?

A

The amount of memory used is constant and is not dependent on data processing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which line on the graph represents constant time?

A

Line A (green line)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which line represents logarithmic time complexity?

A

Line B (yellow line)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which line represents linear time complexity?

A

Line c (blue line)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which line represents quadratic time complexity?

A

Line d (red line)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Algorithms that are said to take the same amount of time executed are called?

A

Constant time algorithms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If the execution time of this algorithm is independent of the size of input, it is considered why type of complexity?

A

O(1) Constant Time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What type of complexity is an algorithm if the time to execute is directly proportional to the input size?

A

O(n) Linear Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Binary search is an example of which time complexity?

A

O(log n) Logarithmic Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What time complexity is the time it takes to run an algorithm is proportional to the logarithm of the input size n?

A

O(Log n) Logarithmic Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What time complexity is an algorithm if the time to execution is proportional to the square of the input size?

A

O(n^2) Quadratic Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Checking to see whether there are any duplicates in a deck of cards is an example of which time complexity?

A

O(n^2) Quadratic Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Algorithms involving nested iterations such as nested loops are which type of time complexity?

A

O(n^2) Quadratic Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Bubble sort is an example of which time complexity?

A

O(n^2) Quadratic Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Selection sort is an example of which time complexity?

A

O(n^2) Quadratic Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Insertion sort is an example of which time complexity?

A

O(n^2) Quadratic Time Complexity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Accessing arrays on average has which time and space complexity?

A

Time = Θ(1)
Space worst case = O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Searching arrays, on average, has which time and space complexity?

A

Time average: Θ(n)
Space worst: O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Array insertion, on average, has which time and space complexity?

A

Time average: Θ(n)
Space worst: O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Array deletion, on average, has which time and space complexity?

A

Time average: Θ(n)
Space worst: O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the best time complexity and the worst space complexity for array quicksort algorithms?

A

Time best: Ω(n log(n))
Space worst: O(log(n))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the best time complexity and the worst space complexity for array mergesort algorithms?

A

Time best: Ω(n log(n))
Space worst: O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is the best time complexity and the worst space complexity for array Timsort algorithms?
Time best: Ω(n) Space worst: O(n)
26
What is the best time complexity and the worst space complexity for array heapsort algorithms?
Time best: Ω(n log(n)) Space worst: O(1)
27
What is the best time complexity and the worst space complexity for array bubble sort algorithms?
Time best: Ω(n) Space worst: O(1)
28
What is the best time complexity and the worst space complexity for array insertion sort algorithms?
Time best: Ω(n) Space worst: O(1)
29
What is the best time complexity and the worst space complexity for array selection sort algorithms?
Time best: Ω(n^2) Space worst: O(1)
30
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)
31
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)
32
What is the best time complexity and the worst space complexity for array bucket sort algorithms?
Time best: Ω(n + k) Space worst: O(n)
33
What is the best time complexity and the worst space complexity for array radix sort algorithms?
Time best: Ω(nk) Space worst: O(n + k)
34
What is the best time complexity and the worst space complexity for array counting sort algorithms?
Time best: Ω(n + k) Space worst: O(k)
35
What is the best time complexity and the worst space complexity for array cube sort algorithms?
Time best: Ω(n) Space worst: O(n)
36
What is the average time complexity and the worst space complexity for stack access algorithms?
Time average: Θ(n) Space worst: O(n)
37
What is the average time complexity and the worst space complexity for Queue access algorithms?
Time average: Θ(n) Space worst: O(n)
38
What is the average time complexity and the worst space complexity for stack search algorithms?
Time average: Θ(n) Space worst: O(n)
39
What is the average time complexity and the worst space complexity for stack insertion algorithms?
Time average: Θ(1) Space worst: O(n)
40
What is the average time complexity and the worst space complexity for stack deletion algorithms?
Time average: Θ(1) Space worst: O(n)
41
What is the average time complexity and the worst space complexity for Queue insertion algorithms?
Time average: Θ(1) Space worst: O(n)
42
What is the average time complexity and the worst space complexity for Queue deletion algorithms?
Time average: Θ(1) Space worst: O(n)
43
What is the average time complexity and the worst space complexity for Singly-Linked Lists access algorithms?
Time average: Θ(n) Space worst: O(n)
44
What is the average time complexity and the worst space complexity for Doubly-Linked Lists access algorithms?
Time average: Θ(n) Space worst: O(n)
45
What is the average time complexity and the worst space complexity for Singly-Linked Lists search algorithms?
Time average: Θ(n) Space worst: O(n)
46
What is the average time complexity and the worst space complexity for Doubly-Linked Lists search algorithms?
Time average: Θ(n) Space worst: O(n)
47
What is the average time complexity and the worst space complexity for Singly-Linked Lists insertion algorithms?
Time average: Θ(1) Space worst: O(n)
48
What is the average time complexity and the worst space complexity for Doubly-Linked Lists insertion algorithms?
Time average: Θ(1) Space worst: O(n)
49
What is the average time complexity and the worst space complexity for Singly-Linked Lists deletion algorithms?
Time average: Θ(1) Space worst: O(n)
50
What is the average time complexity and the worst space complexity for Doubly-Linked Lists deletion algorithms?
Time average: Θ(1) Space worst: O(n)
51
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))
52
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))
53
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))
54
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))
55
What is the average time complexity and the worst space complexity for Hash Table search algorithms?
Time average: Θ(1) Space worst: O(n)
56
What is the average time complexity and the worst space complexity for Hash Table insertion algorithms?
Time average: Θ(1) Space worst: O(n)
57
What is the average time complexity and the worst space complexity for Hash Table deletion algorithms?
Time average: Θ(1) Space worst: O(n)
58
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)
59
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)
60
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)
61
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)
62
What is the average time complexity and the worst space complexity for Cartesian Tree search algorithms?
Time average: Θ(log (n)) Space worst: O(n)
63
What is the average time complexity and the worst space complexity for B-Tree access algorithms?
Time average: Θ(log (n)) Space worst: O(n)
64
What is the average time complexity and the worst space complexity for B-Tree search algorithms?
Time average: Θ(log (n)) Space worst: O(n)
65
What is the average time complexity and the worst space complexity for Cartesian Tree insertion algorithms?
Time average: Θ(log (n)) Space worst: O(n)
66
What is the average time complexity and the worst space complexity for Cartesian Tree deletion algorithms?
Time average: Θ(log (n)) Space worst: O(n)
67
What is the average time complexity and the worst space complexity for B-Tree insertion algorithms?
Time average: Θ(log (n)) Space worst: O(n)
68
What is the average time complexity and the worst space complexity for B-Tree deletion algorithms?
Time average: Θlog (n)) Space worst: O(n)
69
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)
70
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)
71
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)
72
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)
73
What is the average time complexity and the worst space complexity for Splay Tree search algorithms?
Time average: Θ(log (n)) Space worst: O(n)
74
What is the average time complexity and the worst space complexity for Splay Tree insertion algorithms?
Time average: Θ(log (n)) Space worst: O(n)
75
What is the average time complexity and the worst space complexity for Splay Tree deletion algorithms?
Time average: Θ(log (n)) Space worst: O(n)
76
What is the average time complexity and the worst space complexity for AVL Tree access algorithms?
Time average: Θ(log (n)) Space worst: O(n)
77
What is the average time complexity and the worst space complexity for AVL Tree search algorithms?
Time average: Θ(log (n)) Space worst: O(n)
78
What is the average time complexity and the worst space complexity for AVL Tree insertion algorithms?
Time average: Θ(log (n)) Space worst: O(n)
79
What is the average time complexity and the worst space complexity for AVL Tree deletion algorithms?
Time average: Θ(log (n)) Space worst: O(n)
80
What is the average time complexity and the worst space complexity for KD Tree access algorithms?
Time average: Θ(log (n)) Space worst: O(n)
81
What is the average time complexity and the worst space complexity for KD Tree search algorithms?
Time average: Θ(log (n)) Space worst: O(n)
82
What is the average time complexity and the worst space complexity for KD Tree insertion algorithms?
Time average: Θ(log (n)) Space worst: O(n)
83
What is the average time complexity and the worst space complexity for KD Tree deletion algorithms?
Time average: Θ(log (n)) Space worst: O(n)
84
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)
85
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.
86
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.
87
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.
88
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.