Cheatography
https://cheatography.com
Short Explanations of Basic Algorithms
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Backtracking Algorithms
They are algorithms that are generally used in optimisation problems and try all possibilities in solving the problem. The solution is created gradually and all possible solutions are tried and the next step is taken. For example, sudoku and 8 queen problems can be solved with this algorithm. |
|
Brute Force Algorithms
It tries all possibilities until an acceptable solution is obtained. However, these algorithms involve too many operations and the solution path is far from optimum. As the data volume in the problem increases, the chance of solution decreases. |
|
Divide and Conquer Algorithms
They are algorithms in which problems are divided into the smallest possible parts and each sub-part is solved independently of the others and consist of 3 main stages. Divide, conquer and merge.
|
Greedy Algorithms
They are algorithms that aim for the most accurate solution possible for a problem. The basic approach in problem solving is to create a solution for a small subset of the problem and to extend this solution to the overall problem. For example, the problem of calculating the maximum distance to be travelled by a traveller departing from a city can be solved with this algorithm. |
|
Simple Recursive Algorithms
They are algorithms that call themselves directly or indirectly. Problems are reduced to smaller parts and the main problem is solved by combining the solutions created for small parts. For example, below is the C code that finds the factorial calculation with the recursive algorithm.
int Factorial(int n) {
if (n<=1) return 1;
else {
return n* (Factorial(n-1));
}
}
|
|