Cheatography

# Classification of Algorithms Cheat Sheet (DRAFT) by alicanpayasli

Short Explanations of Basic Algorithms

This is a draft cheat sheet. It is a work in progress and is not finished yet.

### Backtr­acking Algorithms

 They are algorithms that are generally used in optimi­sation problems and try all possib­ilities 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 possib­ilities 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 indepe­ndently 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 calcul­ating 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 indire­ctly. 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 calcul­ation with the recursive algorithm. ``int Factor­ial(int n) {`` ``if (n<=1) return 1;`` ``else {`` ``return n* (Facto­ria­l(n­-1));`` ``}````}``