ALGORITHM

 ALGORITHM : Characteristics, Properties, Types , Advantages and Disadvantages


             The word Algorithm means ” A set of rules to be followed in calculations or other problem-solving operations ” Or "A procedure for solving a problem in a finite number of steps that frequently by recursive operations" Therefore Algorithm refers to a sequence of finite steps to solve a particular problem. 
           It can be understood by taking the example of cooking a new recipe. To cook a new recipe, one reads the instructions and steps and executes them one by one, in the given sequence. The result thus obtained is the new dish cooked perfectly. Every time you use your phone, computer, laptop, or calculator you are using Algorithms. Similarly, algorithms help to do a task in programming to get the expected output. The Algorithm designed are language-independent, i.e. they are just plain instructions that can be implemented in any language, and yet the output will be the same, as expected.

Characteristics of Algorithm 

Clear and Unambiguous: The algorithm should be clear and unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning. 

Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs. 

Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well. o Finite-ness: The algorithm must be finite, i.e. it should terminate after a finite time. 

Feasible: The algorithm must be simple, generic, and practical, such that it can be executed with the available resources. It must not contain some future technology or anything.

Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be the same, as expected.

Properties of Algorithm 

  • It should terminate after a finite time. 
  • It should produce at least one output. 
  • It should take zero or more input. 
  • It should be deterministic means giving the same output for the same input case. 
  • Every step in the algorithm must be effective i.e. every step should do some work.

Types of Algorithm 

Brute Force Algorithm: It is the simplest approach for a problem. A brute force algorithm is the first approach that comes to finding when we see a problem. 

Recursive Algorithm: A recursive algorithm is based on recursion. In this case, a problem is broken into several sub-parts and called the same function again and again. 

Backtracking Algorithm: The backtracking algorithm basically builds the solution by searching among all possible solutions. Using this algorithm, we keep on building the solution following criteria. Whenever a solution fails we trace back to the failure point and build on the next solution and continue this process till we find the solution or all possible solutions are looked after. 

Searching Algorithm: Searching algorithms are the ones that are used for searching elements or groups of elements from a particular data structure. They can be of different types based on their approach or the data structure in which the element should be found. 

Sorting Algorithm: Sorting is arranging a group of data in a particular manner according to the requirement. The algorithms which help in performing this function are called sorting algorithms. Generally sorting algorithms are used to sort groups of data in an increasing or decreasing manner. 

Hashing Algorithm: Hashing algorithms work similarly to the searching algorithm. But they contain an index with a key ID. In hashing, a key is assigned to specific data.

Divide and Conquer Algorithm: This algorithm breaks a problem into sub-problems, solves a single sub-problem and merges the solutions together to get the final solution.

Greedy Algorithm: In this type of algorithm the solution is built part by part. The solution of the next part is built based on the immediate benefit of the next part. The one solution giving the most benefit will be chosen as the solution for the next part.

Dynamic Programming Algorithm: This algorithm uses the concept of using the already found solution to avoid repetitive calculation of the same part of the problem. It divides the problem into smaller overlapping subproblems and solves them. 

Advantages of Algorithms 

  • It is easy to understand. 
  • An algorithm is a step-wise representation of a solution to a given problem. 
  • In Algorithm the problem is broken down into smaller pieces or steps hence, it is easier for the program to convert it into an actual program.


Disadvantages of Algorithms 
  • Writing an algorithm takes a long time so it is time-consuming. 
  • Understanding complex logic through algorithms can be very difficult. 
  • Branching and Looping statements are difficult to show in Algorithms

Comments

Popular posts from this blog

INTRODUCTION TO LANGUAGES

DECISION MAKING STATEMENTS IN C