Design & Analysis of Algorithms

0.0(0)
Studied by 1 person
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/94

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:38 AM on 9/23/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

95 Terms

1
New cards


Asymptotic Order of Growth

Big oh, Omega, and Theta

2
New cards

What does it mean for t(n) to be in O(g(n))?

t(n) is bounded above by some constant multiple of g(n) for all sufficiently large n.

3
New cards

What does the set O(g(n)) actually represent?

g(n) must grow at least as fast as t(n) — g(n) is an asymptotic upper bound on t(n).

4
New cards

In t(n) ≤ c·g(n) for all n ≥ n0, what do c and n0 represent?

c is a positive constant multiplier; n0 is the point after which the inequality holds for all larger n

5
New cards

To prove 100n + 5 ∈ O(n²), what's the key inequality chain?

100n + 5 ≤ 100n + n (for n ≥ 5) = 101n ≤ 101n²

Since 101n ≤ 101n² for n ≥ 1, chaining the two inequalities proves the bound.

6
New cards

What values of c and n0 does that proof give for 100n + 5 ∈ O(n²)?

c = 101, n0 = 5

7
New cards

Are the constants c and n0 in a Big-O proof unique?

No — the definition allows freedom in choosing c and n0; multiple valid pairs can work

Different valid inequality chains can lead to different but equally correct (c, n0) pairs.

8
New cards

What's an alternate pair of constants proving 100n + 5 ∈ O(n²), using 100n + 5 ≤ 100n + 5n (for n ≥ 1) = 105n?

c = 105, n0 = 1

9
New cards

In plain terms, what must be true of g(n) relative to t(n) for t(n) ∈ O(g(n))?

g(n) must grow at least as fast as t(n) — it's an asymptotic upper bound

Big-O captures an upper bound on growth rate, not an exact match.

10
New cards

What does it mean for t(n) to be in Ω(g(n))?

t(n) ≥ c·g(n) for all n ≥ n0, for some positive constant c and nonnegative integer n0

This is the formal definition of Big-Omega: t(n) is bounded below by a constant multiple of g(n) for all sufficiently large n.

11
New cards

What does the set Ω(g(n)) actually represent?

g(n) must be slower than (or equal to) t(n) in terms of order of growth — Big-Omega gives a lower bound.

12
New cards

How does the growth-rate relationship in Ω(g(n)) contrast with O(g(n))?

In O(g(n)), g(n) must be faster (or equal); in Ω(g(n)), g(n) must be slower (or equal)

Big-O gives an upper bound (g grows at least as fast as t); Big-Omega gives a lower bound (g grows no faster than t).

13
New cards

What's the key inequality used to prove n³ ∈ Ω(n²)?

n³ ≥ n² for all n ≥ 0

Since n³ grows at least as fast as n² for every n ≥ 0, the inequality holds with no lower bound needed on n.

14
New cards

What values of c and n0 prove n³ ∈ Ω(n²)?

c = 1, n0 = 0

Since the inequality n³ ≥ n² holds for every n ≥ 0, we can pick the smallest possible constants: c = 1 and n0 = 0.

15
New cards

What does it mean for t(n) to be in Θ(g(n))?

c2·g(n) ≤ t(n) ≤ c1·g(n) for all n ≥ n0, for some positive constants c1, c2 and nonnegative integer n0

This is the formal definition of Big-Theta: t(n) is sandwiched between two constant multiples of g(n) for all sufficiently large n.

16
New cards

In c2·g(n) ≤ t(n) ≤ c1·g(n) for all n ≥ n0, how do c1, c2, and n0 work together?

c2 sets the lower bound and c1 sets the upper bound, both holding from the same n0 onward

Both bounds must hold using the same n0 — t(n) is bounded both above and below by positive constant multiples of g(n).

17
New cards

What does the set Θ(g(n)) actually represent?

All functions that have the same order of growth as g(n), up to a constant multiple, as n → ∞

Θ(g(n)) is the "tight bound" set — it combines both O(g(n)) and Ω(g(n)).

18
New cards

Every quadratic function an² + bn + c with a > 0 belongs to which Theta class?

theta (n²)

The an² term dominates for large n, and with a>0 the function is both upper- and lower-bounded by constant multiples of n² — a tight bound.

19
New cards
<p>What is being shown?</p>

What is being shown?

L’Hopital’s rule

20
New cards
<p>What formula is being shown?</p>

What formula is being shown?

Stirling’s formula

21
New cards
<p>What algorithm is being shown? </p>

What algorithm is being shown?

Maximum element

22
New cards
<p>What formula is being shown? </p>

What formula is being shown?

Maximum element

23
New cards
<p>What algorithm is being shown?</p>

What algorithm is being shown?

Element Uniqueness

24
New cards
<p>What formula is being shown? </p>

What formula is being shown?

Element uniqueness

25
New cards
<p>3A_Brute Force_Bubble_selection - 7</p><p>What is the time complexity?</p>

3A_Brute Force_Bubble_selection - 7

What is the time complexity?

O(n²)

26
New cards
<p>3A_Brute Force_Bubble_selection - 12</p><p>What is the time complexity?</p>

3A_Brute Force_Bubble_selection - 12

What is the time complexity?

O(n)

27
New cards
<p>3A_Brute Force_Bubble_selection - 18</p><p>What is the time complexity?</p>

3A_Brute Force_Bubble_selection - 18

What is the time complexity?

O(n)

28
New cards
<p>3A_Brute Force_Bubble_selection - 28</p><p>What is the time complexity?</p>

3A_Brute Force_Bubble_selection - 28

What is the time complexity?

O(n²)

29
New cards
<p>2D_Recursive Analysis_ - 8</p><p>Solve the problem.</p>

2D_Recursive Analysis_ - 8

Solve the problem.

o(n²)

<p>o(n²)</p>
30
New cards
<p>2D_Recursive Analysis_ - 11</p><p>Solve the problem.</p>

2D_Recursive Analysis_ - 11

Solve the problem.

O(n!)

<p>O(n!)</p>
31
New cards
<p>2D_Recursive Analysis_ - 12</p><p>Solve the problem.</p>

2D_Recursive Analysis_ - 12

Solve the problem.

knowt flashcard image
32
New cards
<p>2D_Recursive Analysis_ - 27</p><p>What is the time complexity?</p>

2D_Recursive Analysis_ - 27

What is the time complexity?

O(n)

33
New cards
<p>3B_Exhaustive Search - 13</p><p>Give the tour and costs based on what is provided.</p><p>Tour Ex: a → c → d → b</p><p>Costs Ex: 2 + 4 + 8 + 7 =</p>

3B_Exhaustive Search - 13

Give the tour and costs based on what is provided.

Tour Ex: a → c → d → b

Costs Ex: 2 + 4 + 8 + 7 =

knowt flashcard image
34
New cards

3B_Exhaustive Search - 12

What is the time complexity for the traveling salesman problem?

O(n!)

35
New cards

3B_Exhaustive Search - 16

What is the time complexity of the Knapsack problem?

Omega(2^n)

36
New cards
<p>3B_Exhaustive Search - 20</p><p>What is the time complexity of the Assignment problem?</p>

3B_Exhaustive Search - 20

What is the time complexity of the Assignment problem?

O(n!)

37
New cards
<p>3C_Graph Traversal - 11</p><p>Go through Depth-First Search (DFS) and get the DFS result and output tree.</p>

3C_Graph Traversal - 11

Go through Depth-First Search (DFS) and get the DFS result and output tree.

1, 2, 3, 5, 4, 6

<p>1, 2, 3, 5, 4, 6</p>
38
New cards

3C_Graph Traversal - 24

What is the time complexity of DFS? For adjacency matrix representation and adjacency list representation?

O( |V|² ), O ( |V| + |E| )

39
New cards
<p>3C_Graph Traversal - 30</p><p>Give the DFS result and output tree.</p>

3C_Graph Traversal - 30

Give the DFS result and output tree.

DFS result: a, c, d, f, b, e

<p>DFS result: a, c, d, f, b, e</p>
40
New cards
<p>3C_Graph Traversal - 32</p><p>Give the DFS result and output tree.</p>

3C_Graph Traversal - 32

Give the DFS result and output tree.

0, 1, 2, 3, 4

<p>0, 1, 2, 3, 4</p>
41
New cards
<p>3C_Graph Traversal - 38</p><p>Give the BFS result and output tree.</p>

3C_Graph Traversal - 38

Give the BFS result and output tree.

1, 2, 3, 6, 5, 4

<p>1, 2, 3, 6, 5, 4</p>
42
New cards
<p>3C_Graph Traversal - 53</p><p>Give the BFS result and output tree.</p>

3C_Graph Traversal - 53

Give the BFS result and output tree.


<p></p>
43
New cards
<p>3C_Graph Traversal - 56</p><p>Give the BFS result and output tree.</p>

3C_Graph Traversal - 56

Give the BFS result and output tree.

1, 2, 3, 4

<p>1, 2, 3, 4</p>
44
New cards

3C_Graph Traversal - 58

What is the time complexity of BFS? For adjacency matrix and adjacency list?

O( |V|² ), O( |V| + |E|)

45
New cards

3C_Graph Traversal - 63

DFS and BFS are used for what?

Stack, Queue

46
New cards
<p>2C_Recursive Algorithms_ - 3</p><p>What is the time complexity?</p>

2C_Recursive Algorithms_ - 3

What is the time complexity?

O(n)

47
New cards
<p>4A_DecreaseConquer_insort_topsort - 14</p><p>What algorithm is shown?</p>

4A_DecreaseConquer_insort_topsort - 14

What algorithm is shown?

Insertion sort

48
New cards
<p>4A_DecreaseConquer_insort_topsort - 15</p><p>What algorithm is shown?</p>

4A_DecreaseConquer_insort_topsort - 15

What algorithm is shown?

Insertion sort

49
New cards
<p>4A_DecreaseConquer_insort_topsort - 16</p><p>What algorithm is shown?</p>

4A_DecreaseConquer_insort_topsort - 16

What algorithm is shown?

Insertion sort

50
New cards
<p>4A_DecreaseConquer_insort_topsort - 19</p><p>Is this a directed acyclic graph (dag)?</p>

4A_DecreaseConquer_insort_topsort - 19

Is this a directed acyclic graph (dag)?

Yes

51
New cards
<p>4A_DecreaseConquer_insort_topsort - 19</p><p>Is this a directed acyclic graph (dag)?</p>

4A_DecreaseConquer_insort_topsort - 19

Is this a directed acyclic graph (dag)?

No

52
New cards
<p>4A_DecreaseConquer_insort_topsort - 22</p><p>Solve using topological sort.</p>

4A_DecreaseConquer_insort_topsort - 22

Solve using topological sort.

C2 C1→ C3 → C4 → C5

<p>C2  C1→ C3 → C4 → C5</p>
53
New cards
<p>4A_DecreaseConquer_insort_topsort - 24</p><p>Give the Solution</p>

4A_DecreaseConquer_insort_topsort - 24

Give the Solution

C1, C2, C3, C4, C5

54
New cards
<p>4A_DecreaseConquer_insort_topsort - 30</p><p>Give the Solution</p>

4A_DecreaseConquer_insort_topsort - 30

Give the Solution

B → C → D → E → A

55
New cards
<p>4A_DecreaseConquer_insort_topsort - 32</p><p>Give the Solution</p>

4A_DecreaseConquer_insort_topsort - 32

Give the Solution

2, 1, 0, 4, 3

56
New cards

Kahoot

____ are also called digraphs

directed graphs

57
New cards

Kahoot

A tree is a connected ____ graph.

Acyclic

58
New cards

Kahoot

Binary search tree nodes can have a maximum of two children.

T or F

True

59
New cards

Kahoot

What is the basic operation for sorting algorithms?

Comparison

60
New cards

Kahoot

Euclid’s algorithm includes ___

Mod

61
New cards

Kahoot

Sieve of Eratosthenes algorithm is to find prime numbers.

T or F

True

62
New cards

Kahoot

The function 2^n grows slower than function of (n^2)

T or F

False

63
New cards

Kahoot

The following assertion is incorrect - n^4 + n + 1 E=! O(n²).

False

64
New cards

Kahoot

L’hospital’s rule is associated with the

limit

65
New cards

Kahoot

Theta (n³) is the time complexity of ____ algorithm.

Matrix multiplication

66
New cards

Kahoot

Recursive algorithms must have

best case and recursive case

67
New cards

Kahoot

Each recursive algorithm can be realized with iterative approach.

T or F

True

68
New cards

Kahoot

To analyze recursive algorithms, We can use the ____ technique.

Backward substitution

69
New cards

Quiz Review

What is the time complexity for sequential search best case? And the base operation?

Theta(1), comparison

70
New cards

Quiz Review

What is the time complexity for sequential search worst case? And the base operation?

O(n), comparison

71
New cards

Quiz Review

What is the equation used for Euclid’s?

gcd(m,n) = gcd(n, m mod n)

72
New cards

Quiz Review

What are two main efficiency measures?

Time and space complexity

73
New cards

Quiz Review

Give the equation for the Tower of Hanoi.

2^n - 1

74
New cards

Quiz Review

What is the time complexity?

T(n) = 2T(n-1)+1

Theta(2^n)

75
New cards

Quiz Review

What is the time complexity?

T(n) - nT(n-1)

Theta(n!)

76
New cards

Quiz Review

What is the time complexity?

n

E 1

i = 1

n

77
New cards

Quiz Review

What is the time complexity?

i ← i * 2 loop

Theta(logn)

78
New cards

Quiz Review

What is the equation and time complexity for Maximum Element Comparison?

n - 1, Theta(n)

79
New cards

Quiz Review

What is the equation for this?

n

E i²

i = 1

(n(n+1)(2n+1))/ (6)

80
New cards

Quiz Review

What is the equation for this?

n

E i

i = 1

(n(n+1)) / 2

81
New cards

Quiz Review

What is adjacency list?

List of adjacent vertices for each vertex

82
New cards

Quiz Review

What is the time complexity of three full nested n loops?

Theta(n³)

83
New cards

Quiz Review

What is the time complexity of two full nested n loops?

theta(n²)

84
New cards

Quiz Review

Is queue FIFO or LIFO?

FIFO

85
New cards

Quiz Review

Is stack FIFO or LIFO?

LIFO

86
New cards

Quiz Review

What is being described?
A well-defined computational procedure input → output in a finite time.

Algorithm

87
New cards

Quiz Review

Give the time complexity order.

Constant time → Logarithmic → Linear → Log Linear → Quadratic → Cubic → Exponential → Factorial

88
New cards

Quiz Review

Give another version of this.

Constant time → Logarithmic → Linear → Log Linear → Quadratic → Cubic → Exponential → Factorial

1 < log < n < nlogn < n² < n³ < 2^n < n!

89
New cards

Quiz Review

What is the time complexity of an iterative Fibonacci?

Theta(n)

90
New cards

Quiz Review

What is the time complexity?

T(n) = T(n/3) + 1

theta(logn)

91
New cards

Quiz Review

What is the time complexity?

T(n) = T(n-1) +n

theta(n²)

92
New cards

Quiz Review

What is the time complexity?

m(n) - m(n-1) + 1

Theta(n)

93
New cards

Quiz Review

What is being described?

Store previously computed results to audio repeated computation.

Memorization

94
New cards

Quiz Review

What is being shown?

n(n-1) / 2

Element Uniqueness worst case

95
New cards

Quiz Review

What is the time complexity for element uniqueness worst case?

Theta(n²)