Issues with algrorithms Flashcards
What are the issues that occur when coming up with algorithms?
-> How to design the algorithms
-> How to analyze the efficiency of the algorithm
What are the different approaches that could be used to design an algorithm?
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.
What are the two types of brute-force algorithms?
optimization and sacrificing algorithms.
Which algorithm approach is feasible only with integer problems?
Branch and bound algorithms
What are the common types of algorithms that exist?
Delete, Update, Insert, Search, and Sort algorithms.
Differentiate between priori and posterior analysis.
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.
What is the performance analysis of an algorithm?
It means predicting the resources required for an algorithm to be executed
What are the types of big O’s?
O(logn) -> logarithmic
O(1) -> constant
O(n) -> linear
O(n^2) -> Quadratic
O(2^n) -> exponential
O(n!) -> factorial
What are the factors that determine the running time of an algorithm?
- Whether is running on:
-> a single or multi-core processor
-> 32 or 64-bit machine - the read and write speed of the machine
- The arithmetic and logic operation speed
What is the space that data types use in c use?
char -> 1byte
int -> 4bytes
float -> 4bytes
double -> 8bytes
long -> 8bytes
short -> 2bytes