Intro and Asymptotic Notation and Complexity Flashcards

1
Q

What does the Big-O notation represent

A

The upper bound (worst case) on the growth rate of an algorithm’s running time

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

What does Θ(theta) notation represent

A

It gives the tight (exact) bound, both upper and lower, on an algorithms growth

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

What is the relationship between f(n) = o(g(n)) and f(n) = O(g(n))?

A

If f(n) = o(g(n)), then f(n) is strictly smaller than g(n) for large n, and it also implies f(n) = O(g(n))

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

Order the following by growth (ascending): O(log n), O(n), O(n log n), O(n²), O(2ⁿ)

A

O(log n) < O(n) < O(n log n) < O(n²) < O(2ⁿ)

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

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

A

O(n²) — it expands to an arithmetic series.

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

What is the Master Theory format

A

T(n) = aT(n/b) + f(n)

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

What’s the complexity of T(n) = 2T(n/2) + n?

A

O(n log n) → classic Merge Sort recurrence.

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

What is an algorithm

A

A finite sequence of unambiguous introuctions to solve a problem

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

Solve T(n) = T(n/2) + log n

A

O(log² n) — Use recursion tree; Master Theorem doesn’t apply directly.

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

Solve T(n) = 4T(n/2) + n

A

O(n²) — Master Theorem, Case 1: f(n) = O(n^(log_b a - ε)) → log₂4 = 2

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

What is the complexity of T(n) = T(n/4) + n²?

A

O(n²) — Master Theorem, Case 3 (f(n) dominates)

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

Can the Master Theorem solve T(n) = T(n/2) + n log n?

A

No — f(n) = n log n does not fit Case 1, 2, or 3 directly.

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

What is the condition for applying the Master Theorem?

A

T(n) = aT(n/b) + f(n), with constants a ≥ 1, b > 1 and f(n) positive.

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

What is sedgewicks definition of an algorithm

A

describes methods for solving problems that are suited for computer implementation

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

What is Aho, hopcroft and ultman definition of an algorthm

A

a finite sequence of intructions which have a clear meaning and cen be performed with a finite amount of effort in a finite length of time

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

What is wikapedias definition of an algorthm

A

an algorithm is a finite sequence of mathematically rigourous instructions, used to solve a of class of specific problems or to perform computation

17
Q

What is levins definition of an algorithm

A

a finite sequence of instructions of unabiguous intrions for solving as problem

18
Q

What is the GCD

A

gives largest natural number that divides two numbers, can be found with the GCD

19
Q

Is the function 100n+5 = O(n2
)
a) Yes
b) No
c) Only for large values of n
d) Only for small values of n
e) Can’t be determined

A

yes is correct because O(n²) includes all functions that grow slower or equal to n² in the long run.

20
Q

What are the 7 growth functions

A
  1. Constant time
  2. Logarithmic, log n
  3. Linear, n
  4. Polylogarithmic, n^k logn
  5. Quadratic, n^2
  6. Cubic, n^3
  7. Exponential
21
Q

What is a constant time growth function

A

for example so,ething that returns a element

22
Q

What is a logirithmic growth function

A

occurs in algorithms that transform a bigger problem into a smaller problem, input size a ration of the original problem

23
Q

What is a linear growth function

A

Algorithms that are forced to pass through all element sof the input (of size n) a number (constant) times yeild linear running time

24
Q

What is a polylogarithmic growth function

A

an algorthm that breaks the problem into smaller parts, solves the problem for the smaller parts and then combines the solution

25
What is the worst case
where the input is the worst case input of size n for which the algorithm runs the longest amoung all possible inputs of that size
26
What is the best case
best case input size for which the alghorithm runs the fastest amoung all inputs of that size
27
What is the average case
neither the worst nor the best case running, given by the average case efficiency of an algorithm.
28
What does the omega notation mean Ω
It describes the best case. (lower bound) it bounds the function form above and below, hence represenmts the exact growth of the running time
29
What type algorithms is the master theorm designed for
T(n) = aT(n/b) + f(n)
30