Connect with us


What Is Algorithm in Computer, Programing With Example



What is Algorithm in computer

In this lesson, I Will Explain What an is Algorithm in Computer, Programing With an Example.

What is  Algorithm in Computer?

An Algorithm is a procedure for accomplishing some task which, given an initial state, will terminate in a defined end-state. However, the computational complexity and efficient implementation of the algorithm is important in computing, and this depends on suitable data structures.

the concept of an algorithm is often illustrated by the example of a recipe, although many algorithms are complex often have steps that repeat or require decisions. However, Algorithm Can be composed to create a more complex algorithm.

The Concept of an algorithm originated as a means of recording procedures for solving mathematical problems such as finding the common divisor of two numbers or multiplying two numbers. The concept was formalized in 1936 through Alan Turing machines and Alonzo Church’s Lambda calculus. So that, in turn, formed the foundation of computer science.

Read More: What is logic Gates

Example :

One of the simplest algorithms is to find the largest number in a list of numbers. The solution necessarily requires looking at every number in the list, but only once at each. So from this follows a simple algorithm, which can be stated in a high-level description of English prose, as:

  • High-Level Description:

Assume the first item is the largest.

Look at each of the remaining items in the list and if it is larger than the largest item so far, make a note of it.

The last noted item is the largest in the list when the process is complete.

Formal description: Written in prose but much closer to the high-level language of a computer program, the following is the more formal coding of the algorithm in pseudocode or pidgin code:

Algorithm Largest Number

Input: A non-empty list of numbers L.

Output: The Largest number in the list L.

Largest? L0

for each item in the list L=1, do

if the item>largest, then

largest? Does the item

return? the item

return largest

However, “?” is loose shorthand for “changes to”. For instance,” largest? item” means that the value of largest changes to the value of the item. So that  “return” terminates the algorithm and outputs the value that flows.

Read More: What is Wireless Networking?

What Is Algorithm in programing?

Most algorithms can be directly implemented by computer programs. Many Programming languages sometimes use the algorithm as a function.

  • Representation of Algorithms

There is various way in which an algorithm can be represented. However, Programmers normally use one or more of the following ways to represent their algorithms :

♦ As programs.

♦ As flowcharts.

♦As pseudocodes.

♦As decision tables.


If you like the article please comment below to improve our articles 🙂