DAA notes

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

1/90

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:59 AM on 6/15/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

91 Terms

1
New cards

In algorithm analysis, what are Asymptotic Notations used to describe?

How execution time or memory space scales as input size grows toward infinity ($n$).

2
New cards

Which asymptotic notation represents the upper bound or the worst-case scenario for an algorithm?

Big O notation ($\le$).

3
New cards

Which asymptotic notation represents a strict upper bound ($<$)?

Little o notation.

4
New cards

Term: Big Omega ($\Omega$)

Definition: A notation representing the lower bound or best case, where running time grows at least this fast.

5
New cards

Which asymptotic notation denotes a strict lower bound ($>$)?

Little omega ($\omega$).

6
New cards

Concept: Big Theta ($\Theta$)

Definition: A tight bound where the upper and lower bounds are identical, indicating the running time grows at an exact match rate.

7
New cards

Which algorithm design paradigm breaks problems down into smaller identical sub-problems and then combines them?

Divide and conquer.

8
New cards

List three examples of algorithms that utilise the divide and conquer paradigm.

Merge sort, quick sort, and binary search.

9
New cards

How does the greedy approach make decisions during problem-solving?

It makes the best, most optimal choice at that specific moment (a locally optimal choice).

10
New cards

What is a primary drawback of using a greedy approach for complex problems?

It does not always find the globally optimal solution.

11
New cards

Give three examples of problems typically solved using a greedy approach.

Dijkstra's shortest path algorithm, spanning tree algorithms, and the fractional knapsack problem.

12
New cards

In dynamic programming, where are the results of sub-problems stored to avoid redundant calculations?

In a table, such as an array or hash map (caching).

13
New cards

What are the two main strategies used in dynamic programming?

Top-down (memoisation) and bottom-up (tabulation).

14
New cards

The strategy in dynamic programming involving a top-down approach is commonly known as _____.

Memoisation

15
New cards

The strategy in dynamic programming involving a bottom-up approach is commonly known as _____.

Tabulation

16
New cards

List three examples of problems that can be optimised using dynamic programming.

Longest common sequence, Floyd-Warshall, and Fibonacci sequence optimisation.

17
New cards

How does the backtracking paradigm explore potential solutions?

It models the problem as a tree and explores paths, returning to a previous state if it hits a dead end.

18
New cards

Provide two classic examples of problems solved via backtracking.

N-queens and Sudoku.

19
New cards

Which algorithm design paradigm evaluates every possible configuration to find a solution?

Brute force.

20
New cards

What is the primary advantage of the brute force approach?

It is guaranteed to find the optimal solution if one exists and is easy to code.

21
New cards

Why is the brute force approach often considered impractical for large inputs?

It has terrible time complexity.

22
New cards

Linear search and selection sort are examples of which algorithm design paradigm?

Brute force.

23
New cards

How is recursion defined in the context of algorithm design?

A technique where a function calls itself to solve a problem.

24
New cards

Identify three specific areas where recursion is particularly effective.

Tree and graph traversals, divide and conquer algorithms, and backtracking.

25
New cards

What are the two mandatory structural components of every valid recursive function?

The base case and the recursive case.

26
New cards

Concept: Base Case

Definition: The condition that tells the recursion to stop by providing a direct answer for the smallest possible input.

27
New cards

What happens to a recursive function if the base case is missing?

It will call itself infinitely, leading to a Stack Overflow error.

28
New cards

Concept: Recursive Case

Definition: The part of the function that calls itself with a modified, smaller input to move closer to the base case.

29
New cards

What must happen to the input in each successive recursive call?

It must be modified and made smaller to move closer toward the base case.

30
New cards

What is the difference between direct and indirect recursion?

Direct recursion is when function A calls itself; indirect recursion is when function A calls function B, which then calls A.

31
New cards

Term: Tail Recursion

Definition: A type of recursion where the recursive call is the absolute last statement executed by the function.

32
New cards

How can any problem solvable by recursion alternatively be solved?

Iteratively, using standard for and while loops.

33
New cards

How does recursion generally compare to iteration regarding memory usage?

Recursion typically uses more memory.

34
New cards

What is a common stylistic advantage of recursion over nested loops?

Recursive code is often cleaner and shorter.

35
New cards

What is the primary purpose of Prim's algorithm?

To find a minimum spanning tree in a graph.

36
New cards

In the context of scaling, what does the variable '$n$' typically represent in asymptotic notation?

The input size.

37
New cards

Which notation implies that the growth rate of an algorithm's running time is $\le$ a specific function?

Big O notation.

38
New cards

Which notation implies that the growth rate of an algorithm's running time is $\ge$ a specific function?

Big Omega ($\Omega$).

39
New cards

Which algorithm design paradigm is Dijkstra's shortest path algorithm classified under?

Greedy approach.

40
New cards

Which paradigm is characterised by exploring paths and abandoning them upon reaching a 'dead end'?

Backtracking.

41
New cards

In the divide and conquer paradigm, what must be true about the sub-problems created?

They must be identical sub-problems of the same type as the original.

42
New cards

Which DP strategy involves 'tabulation'?

The bottom-up strategy.

43
New cards

Which DP strategy involves 'memoisation'?

The top-down strategy.

44
New cards

What is the result of an infinite recursive loop on computer memory?

It causes a Stack Overflow error by exhausting available memory.

45
New cards

Another name for indirect recursion is _____ recursion.

Mutual

46
New cards

Which algorithmic strategy is used to solve the Fractional Knapsack problem?

Greedy approach.

47
New cards

Merge sort is an example of the _____ paradigm.

Divide and conquer

48
New cards

Selection sort is an example of the _____ paradigm.

Brute force

49
New cards

Is it possible for an iterative loop to solve the same problems as recursion?

Yes, any problem solvable by recursion can also be solved iteratively.

50
New cards

What is the 'Exit Door' of a recursive function called?

The base case.

51
New cards

What is the 'Step Down' of a recursive function called?

The recursive case.

52
New cards

In which notation is the running time growth rate an exact match to the bound?

Big Theta ($\Theta$).

53
New cards

The Floyd-Warshall algorithm is an application of which paradigm?

Dynamic programming.

54
New cards

Solving the N-queens problem is a typical application of _____.

Backtracking

55
New cards

Binary search belongs to the _____ paradigm because it repeatedly halves the search space.

Divide and conquer

56
New cards

A locally optimal choice is the hallmark of the _____ approach.

Greedy

57
New cards

What does a lower bound (Big Omega) indicate about an algorithm's running time?

It indicates the algorithm will run at least that fast or take at least that much time.

58
New cards

In recursion, when function A calls function B and function B calls function A, it is known as _____ recursion.

Indirect (or Mutual)

59
New cards

Dynamic programming solves sub-problems _____ time(s) and caches the result.

One

60
New cards

Which paradigm is often easy to code but suffers from high time complexity?

Brute force.

61
New cards

Fibonacci sequence optimisation using a table is an example of _____.

Dynamic programming

62
New cards

The absolute last statement in a tail-recursive function must be the _____.

Recursive call

63
New cards

Big O notation describes the _____ bound of an algorithm.

Upper (or worst-case)

64
New cards

Big Omega notation describes the _____ bound of an algorithm.

Lower (or best-case)

65
New cards

A tight bound means that the upper and lower bounds are _____.

Identical

66
New cards

Why is recursion considered 'cleaner' than iteration for certain problems?

It avoids the complexity of multiple nested loops.

67
New cards

What specific graph structure is Prim's algorithm designed to find?

A minimum spanning tree.

68
New cards

Which notation represents a growth rate strictly greater than the given bound?

Little omega ($\omega$).

69
New cards

Which notation represents a growth rate strictly less than the given bound?

Little o.

70
New cards

When a recursive call is made, how should the input relate to the original input?

It should be a modified, smaller version of the input.

71
New cards

The _____ case provides a direct, non-recursive answer for the smallest possible input.

Base

72
New cards

Which algorithm is a classic example of the Greedy approach for finding the shortest path?

Dijkstra's shortest path algorithm.

73
New cards

Greedy algorithms are generally _____ but do not always find the globally optimal solution.

Fast

74
New cards

How does dynamic programming improve upon simple recursion for problems with overlapping sub-problems?

By caching the results of sub-problems to avoid re-calculating them.

75
New cards

Which search algorithm is a brute force method?

Linear search.

76
New cards

What model does backtracking use to explore paths to a solution?

A tree model.

77
New cards

If an algorithm's running time grows at exactly the same rate as its upper and lower bounds, it is a _____ bound.

Tight

78
New cards

In terms of memory, recursion uses more space because it needs to maintain the _____.

Call stack (or stack frames).

79
New cards

Which sorting algorithm mentioned is an example of Brute Force?

Selection sort.

80
New cards

Quick sort uses the _____ paradigm to sort elements.

Divide and conquer

81
New cards

Huffman encoding algorithm

compression algorithm to reduce size of files

82
New cards

universal hashing

choosing has function randomly from a family of hash functions so that no adversarial input can consistently cause collisions which is a weakness of using a single fixed hash function

83
New cards

best technique for finding the lower bound of a problem like sorting

decision tree model

84
New cards

recurrence relations

used to analyze runtime of divide and conquer algorithms like merge and quick sort

85
New cards

components of space complexity

data space and instruction space

86
New cards

environmental stack space

component of space complexity used to save info needed to resume execution of partially completed functions

87
New cards

constant space

subset of data space reserved for values that dont change

88
New cards

principle of optimality

an optimal solution to a problem contains optimal solutions to its subproblems.

89
New cards

what data structure does BFS use?

queue

90
New cards

what data structure does DFS use?

stack

91
New cards

is DFS recursive or iterative?

recursive