Introduction to Algorithms: Thanks For Landing on to this article here we’ll see a brief introduction to algorithms and programming languages. So, without wasting much time let’s get started.
What is Algorithm?
The Algorithm is a step-by-step procedure for solving any problem in a finite number of steps. It is a logical and mathematical approach to crack any problem using a possible method. These algorithms are widely used in various areas to carry a required output. By the end of this article, we can get the basic idea about algorithms and their types. So, let us further discuss the introduction to algorithms.
Why are algorithms very important?
As we have seen in the introduction to algorithms part they are very important in computer science field. Choosing of best algorithm to perform a given task makes sure that it will solve the problem in a possible manner effectively by using all the available resources.
We can also ensure speed results for the problem and less amount of memory consumption using the appropriate algorithm.
How must an Algorithm be?
An Algorithm should satisfy the certain properties to find an optimized solution to the problem.
An Algorithm must be-
- Written in Simple English.
- Unambiguous, precise and lucid.
- At least one input and output must be there.
- The finite number of steps.
- Every statement should be definitive i.e., self-explanatory.
- Should have an endpoint with the correct solution.
Types of Algorithms:
When we try to solve the problem using an algorithm, before that we must study the type of algorithm we are going to use because in some cases the choice of the wrong algorithm can make your program take millions of years to run. No matter how fast your hardware may be. So let us see the various types of algorithms and their methodologies to solve a solution.
Now let us see what are those and how it solves.
- Simple Recursive algorithms:
- These are the algorithms which take simpler input values and performs simpler operations for obtaining an output.
- Here Problem is divided into smaller versions then we can easily identify easily unsolvable problems and solve them using again these recursive algorithms.
- Backtracking Algorithms:
- Generally, these backtracking algorithms are used to solve most of the computational issues especially constraint satisfaction problems i.e., problems who has to satisfy certain limitations or constraints to solve it.
- In this Backtracking algorithms, first, it finds the solution for sub-problem and using that solution it tries to solve the other problems recursively. If it fails to solve the problem using the technique of the previous sub-problem then the process is backtracked and it solves from the beginning.
- The process is ended if there are no more solutions for the first sub-problem.
- Divide and Conquer Algorithms:
- This Divide and conquer algorithm mainly works by breaking a problem into two or more subproblems and combining all the similar subproblems and solving them directly.
- All the solutions of subproblems are combined to give the solution of the original problem.
- Greedy Algorithms:
- Greedy Algorithm makes the appropriate choice at each step as it attempts to find the overall optimal way to solve the entire issue.
- But most of the cases this greedy algorithms cannot find the optimal result.
- Sometimes it fails to find globally optimal result because it does not consider the updates that may occur in future.
- Branch and Bound Algorithms:
- Generally, this method is used for finding solving optimization problems i.e., these are the problems looking for an object like an integer, permutations or graphs from the finite set.
- In this methods, a state space tree for all the possible solutions are generated and these set of these solutions forms in the shape of a tree with the full set at the root.
- These branches of the tree represent the subsets of the solution set.
- The algorithm depends on the estimation of lower and upper bounds of branches of the search space.
- Brute force Algorithms:
- This algorithm is a straightforward approach to solve a problem as it tries to solve a problem using a large number of patterns so these are also called pattern matching algorithms.
- It checks all the patterns to check whether it satisfies the problem’s definition or not.
- In some cases, it is very simple and relies on raw computing power to achieve results.
- Randomized Algorithms:
- A Randomized Algorithm is mainly depended on the random numbers for its operation.
- These algorithms generate randomness using random numbers either to help to find a solution to the problem or to improve the optimized solution for the problem.
- This randomness reduces either the running time or the time complexity, or the memory used or space complexity.
- Dynamic Programming Algorithms:
- Dynamic Programming Algorithm is a mathematical optimization method as well as computer programming method where it breaks the entire complicated problem into simpler subproblems in a recursive manner.
- This Algorithm is applicable if the subproblems are nested recursively inside larger problems and this leads to making the relationship between the values of the larger problem to the values of the subproblems. This relationship is called the Bellman equation.
Pros and Cons of using algorithms:
- Algorithms are very easy to write and easy technique to understand the logic step-by-step without any confusion.
- By using an appropriate algorithm for our problem we can finally encounter the optimized result.
- Even the person who doesn’t have the knowledge about the particular topic can easily identify the mistakes in that steps.
- But it is a time-consuming process when we don’t have the perfect knowledge about the algorithm that we are using.
- It is difficult to show branching and looping for all the processes.
- Complicated tasks are very difficult to put in algorithms.
Now let us go through some daily life examples of usage of algorithms:
Introduction To Algorithms in our daily life:
- Every time when we google something, then search engine searches thousands of pages and gives we the appropriate content we are looking for in a fraction of seconds.
This is only possible because of underlying algorithms embedded in the software.
- When we use automatic teller machines (ATM’s) and enter your details then we are getting all our details by using some algorithms for matching our details.
- When we are booking tickets or buy something online then these algorithms are used to give the priority to the various number of users from different parts of the world.
- When we are performing any online transactions these algorithms play a vital role.
- Even the Duckworth-Lewis method (D/L) is an algorithm that is applied to the particular game situation that interrupts playing time to suggest how to proceed.
If you like this article (Introduction To Algorithms And Programming Languages) from us let us know your thoughts in the comments section and feel to share with your friends and family. So, that they can also get benefit from this.