Types of Algorithms Part 1
An algorithm is a “sequence of mathematically rigorous instructions”.
It is used to “solve a class of specific problems or to perform a computation computer as specifications for performing calculations and data processing.” Basically, it can be compared to a recipe, where it follows a set of precise steps used to solve a problem or perform a calculation.
Just like models, it encompasses various essential frameworks that addtess the problem-solving process.
Here are four crucial algorithms with names that may sound fictional, yet they genuinely correspond to their functions:
1. Brute Force Algorithms: These algorithms solve problems by examining all possible solutions until the correct one is found. They are simple to understand but inefficient for large datasets due to high time complexity.
Comparison Example:
Think about testing each key on a key ring until you discover the correct one. It's simple but slow.
2. Divide and Conquer Algorithms: Tackles problems by splitting them into smaller, more manageable subproblems. Each subproblem is solved independently, and then their solutions are combined to address the original issue.
Comparison Example:
Imagine dividing a large task into smaller, manageable pieces. Address each individual task, and then combine the outcomes to successfully complete the overall project.
3. Greedy Algorithms: Prioritizes in making the optimal choice at every stage, aiming to reach the overall best outcome. They build a solution step by step, always choosing the next element that offers the most immediate benefit.
Comparison Example:
It’s similar to making choices. choosing the best option one step at a time, always focusing on what works best in the present moment.
4. Dynamic Programming (DP) Algorithms: Breaks big problems into smaller ones. It solves each small problem once, saves the answer, and reuses it later. This way, it avoids doing the same work over and over, making it faster than brute force.
Comparison Example:
Imagine climbing a mountain and reflecting on the path taken and the energy expended. At a fork in the road, you can use your previous marks to select the easiest route, avoiding the steep hill again.
Come back for Part 2 to take a deeper look at the different Types of Algorithms.