Issues with algrorithms Flashcards

1
Q

What are the issues that occur when coming up with algorithms?

A

-> How to design the algorithms
-> How to analyze the efficiency of the algorithm

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

What are the different approaches that could be used to design an algorithm?

A

Acronym: RBG-BD

Randomized Algorithms: also known as a probability algorithm it is one where random bits are added to its input to produce varying outputs.

Brute Force Algorithms: Also known as the exhaustive search algorithm, one where all the possible solutions to a problem are searched to solve that problem, it is divided into two types optimization and sacrificing algorithms.

Greedy Algorithm: It is an algorithm that tries to solve a problem over multiple iterations, but with every iteration, it makes an optimal decision with the aim of providing an optimal solution.

Branch and Bound Algorithms: It is an algorithm that divides all the possible solutions of a problem into subsets, and these subsets are further evaluated to find the best solution

Divide and Conquer Algorithm: It is an algorithm where a problem is divided into smaller manageable problems and solved individually, and then their solutions are combined into a single solution to solve the original problem.

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

What are the two types of brute-force algorithms?

A

optimization and sacrificing algorithms.

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

Which algorithm approach is feasible only with integer problems?

A

Branch and bound algorithms

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

What are the common types of algorithms that exist?

A

Delete, Update, Insert, Search, and Sort algorithms.

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

Differentiate between priori and posterior analysis.

A

Priori analysis is the theoretical analysis of an algorithm done before the algorithm is implemented, factors like RAM, processor speed, OS e.tc are taken into consideration during this state
Posterior analysis is the practical analysis of an algorithm after the algorithm has already been implemented. The factor taken into consideration here is the input size of the algorithm.

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

What is the performance analysis of an algorithm?

A

It means predicting the resources required for an algorithm to be executed

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

What are the types of big O’s?

A

O(logn) -> logarithmic
O(1) -> constant
O(n) -> linear
O(n^2) -> Quadratic
O(2^n) -> exponential
O(n!) -> factorial

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

What are the factors that determine the running time of an algorithm?

A
  1. Whether is running on:
    -> a single or multi-core processor
    -> 32 or 64-bit machine
  2. the read and write speed of the machine
  3. The arithmetic and logic operation speed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the space that data types use in c use?

A

char -> 1byte
int -> 4bytes
float -> 4bytes
double -> 8bytes
long -> 8bytes
short -> 2bytes

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