# Algorithms ## Types of Algorithms ### Iterative - An algorithm that is called repeatedly but for a finite number of times, each time being a single iteration. - Often used to move incrementally through a dataset. ### Recursive - An algorithm that calls itself in its definition. - The **recursive case** in a conditional statement is used to trigger the recursion. - The **base case** in a conditional statement is used to break the recursion. ### Greedy - An algorithm that follows the problem solving heuristic of making the locally optimal choice at each stage with the hope of finding a global optimum. - The general five components, taken from [Wikipedia](http://en.wikipedia.org/wiki/Greedy_algorithm#Specifics): - A **candidate set**, from which a solution is created. - A **selection function**, which chooses the best candidate to be added to the solution. - A **feasibility function**, which is used to determine if a candidate can be used to contribute to a solution. - An **objective function**, which assigns a value to a solution, or a partial solution. - A **solution function**, which will indicate when we have discovered a complete solution. ## Important Algorithms - [Search Algorithms](2.1%20-%20Search%20Algorithms.md) - Sequential Search - Binary Search - [Sorting Algorithms](2.2%20-%20Sorting%20Algorithms.md) - Selection Sort - Bubble Sort - Insertion Sort - Merge Sort - Quicksort - Heap Sort - Radix Sort - [Tree & Graph Traversal Algorithms](2.3%20-%20Tree%20&%20Graph%20Traversal%20Algorithms.md) - Breadth-First Traversal - Depth-First Traversal (Pre-Order, In-Order, Post-Order)