Introduction To Algorithm


An algorithm is a finite set of steps defining the solution of a particular problem. It is expressed in pseudo code, but with some statements in English rather than in the Programming Language.

As we know there are many ways to solve a problem, programmers seek to create the most effective algorithms possible. By using highly-efficient algorithms, developers can ensure their programs run as fast as possible and use minimum system resources.

Example 1

Lets us try to develop an algorithm to compute and display the sum of two nunbers:

  1. START
  2. Read two numbers a and b.
  3. Calculate the sum of a and b and store it in sum.
  4. Display the value of sum.
  5. STOP

Example 2

Algorithm to calculate the Factorial of a given number:

  1. START
  2. Read the number n.
  3. [Initialization] i <- 1, fact <- 1
  4. Repeat steps 4 through 6 until i = n;
  5. fact <- fact * i
  6. i <- i * 1
  7. Print fact




Web Designer, WordPress Developer, Blogger

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Composing a Cutscene in Unity

Ever since I was a little boy, I have only ever wanted to be a Doctor.

How to get help with your programming problem

Monitoring ZFS on Unraid

Using SSL certificates from Let’s Encrypt in your Kubernetes Ingress via cert-manager

Understanding Radix Sort

Airboard: Improving time-to-market on AWS

Promote your NFTs Free:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amit Kushwaha

Amit Kushwaha

Web Designer, WordPress Developer, Blogger

More from Medium

Most Asked Java Interview Questions and Answers

Single & Multidimensional Arrays in Java

Inheritance concept in java

Chapter 1 — Dive in a quick dip

source : “Head First Java” by Kathy Sierra & Bert Bates