Asymptotic notation and Algorithms Flashcards

1
Q

List the asymptotic order from lowest to highest

A
  1. Constant O(1)
  2. Logarithmic (log n)
  3. Linear (n)
  4. Linear Logarithmic (nlogn)
  5. Quadratic (n^2)
  6. Polynomial (n^k)
  7. Exponential (2^n)
  8. Factorial (n!)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Name two brute force sorting algorithms

A

Selection Sort and Bubble sort

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

What is the Big O of selection sort?

A

Quadratic: O(n^2)

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

What is the big O of bubble sort?

A

Quadratic: O(n^2)

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

What is the big O of the TSP using Brute Force?

A

O(n!)

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

Name two Divide and Conquer sorting algorithms

A

Merge sort and quick sort

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

What is the big O of merge sort?

A

O(nlogn) - Log linear

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

Name two transform and conquer alogorithms

A

Fast Fourier Transform
AVL tree rotation

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

Name two decrease and conquer algorithms

A

Binary search
Insertion sort

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

What category does merge sort fall under?

A

Divide and Conquer

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

Explain the divide and conquer algorithm category

A

Breaks a problem into smaller, manageable subproblems.
Solves each subproblem independently.
Combines solutions of subproblems to solve the original problem.

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

Explain the decrease and conquer algorithm category

A

Reduces the problem instance’s size or complexity to solve it iteratively.
Solves a smaller instance of the same problem.
Repeats this process until reaching the base case.

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

Explain the transform and conquer algorithm category

A

Transforms the problem into a different representation, making it easier to solve.
Solves the transformed problem.
Transforms the solution back to the original problem.

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

Explain the greedy category

A

Makes the locally optimal choice at each step with the hope of finding a global optimum.
Does not reassess previous choices.
May not always result in the best overall solution.

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

explain the dynamic sets category

A

Breaks a complex problem into simpler subproblems.
Solves each subproblem just once and stores its solution in a table (memoization).
Utilizes the solutions of subproblems to solve larger instances.

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

What is worst case of Breadth first search?

A

O(|V|+|E|)