What is Algorithm and How To Write With Ease?

What is Algorithm With Example

You will not know what an algorithm is, and if you do not know it, you will not know how to write an algorithm. But today, I will try to give you some more information along with the answer to both your questions, which will be related to Algorithm.

Whoever gets the answers to all your questions.

Every day we get up at work as soon as we wake up in the morning. From the beginning to the completion of every job, some steps are followed. Every task is like a problem for you, and the solution to the problem is found by working. To solve, we set a sequence.

Let’s understand with an example, “You have to make tea”, so to complete this work, we need to follow some sequence. In the same way, if you are making bread, then to follow this work, you also follow some steps. Steps to make the following tea are given.

  1. First of all, put water in a vessel and heat it.
  2. Add tea leaf, sugar and milk to the water.
  3. Wait till the tea boils.
  4. Turn off the gas and sieve the tea.
  5. Tea is ready; now you can drink it.

We can call this example the above Algorithm because it is in a sequence. If you change any order, tea will not be made. Sayyid should not become something else. By now, you must have had a slight idea of ​​what an Algorithm is. Your question is, ” this computer How to do the job. ”

For the computer to perform specific tasks, computer programs are written. Now in the Computer Program, we write a lot of steps. The steps that Computer Execute performs and finishes the job.

When you tell the computer some work, you must also wonder how the computer does these tasks. For this, we use Computer Algorithm. So let’s know from bed what is an algorithm.

What is Algorithm

Algorithm (Al-go-with-um) This is a Procedure (Step by Step Process), or it is a Formula, which solves a problem. This is a procedure that has limited rules, which are also called Instruction.

The rules are written one after the other, and each step shows some or some operation. Solutions to the problem come out through these rules.

In other words, Algorithm is a step by step process to solve any problem or problem. Now we understand in a slightly simpler language Algorithm contains some steps in which each step represents an operation.

One step starts, and finally, there is one step that ends and between these two steps, there are many more steps that do different tasks.

Like, you are making rice is your problem. To finish this task, let’s write some steps. First, the rice has to be washed, heat the water, heat the water, add rice, and wait for the rice to boil.

Prepare rice in 10-15 minutes. Now here, every step performs some operation. For example, washing rice is washed by adding water to the cooked rice. Every such step has different functions. See here; we have divided the problem into small steps; this is what you had to understand.

The algorithm is used a lot in programming. So let’s know from bed how and where they are used.

Uses/Importance Of Algorithm

The algorithm is used everywhere like. You can also answer the problems of your every day through this step by step process. Technically speaking, more is used in the IT industry, business model, programming. So let’s know about its uses one by one.

  • In Computer Programming, Algorithm is written before writing the program. If you are a Computer Sc, IT, BCA and MCA student, you have to write a program. Like, Check whether the Number is Prime and Not? If you start writing this program without thinking, you can see any errors in the Syed program. You can reduce these errors if you first create the algorithm.
  • The algorithm is written before creating a flowchart—otherwise, chances of making mistakes increases.
  • Computer Scientist and Software Engineer use it. Because its use reduces their time and dignity. For example, a software company has to develop an app for SBI. This is a problem for the Software Engineer; the solution will be by writing it step by step. If there is a problem or mistake, then the answer is found there, which is easy to develop the application.
  • Search Engine, In Facebook like, google map Shortest Path, Rating, Searching, etc it all works through an algorithm.
  • It would be used to solve Mathematical Problem Solve, like take a small example. You have to find a number –ve or + ve ?. Your mind must have come to the answer immediately that you can tell by looking at the + and – signs. But you will understand this, but how will the computer understand. For this, you have to write the algorithm. If a number is greater than 0, it is + ve Number, and if it is less than 0, it is a number –ve number.
  • It is also needed to write Pseudo Code, or else Pseudocode has to be rewritten.
    You can also solve the problems of personal life. Like I have to get up early tomorrow morning. First of all, how to write its steps 1. I want to sleep fast. 2. Alarm is to be kept away. 3. Now go to sleep. 4. If you wake up in the morning, then wake up and stop the alarm. 5. Go to the mouth—the 5. Work Finishing Steps are also an Algorithm. (This example is taken to explain)
  • AI, space research, robotics Fields are in much use.

This was the question, why should Algorithm? This question was something like this, why do we work? It is essential to have a process to finish every work properly.

Characteristics Of Algorithm

You know this Algorithm is a Step by Step Procedure. This makes it clear that the steps will be executed to get the Desired Output. The algorithm is analysed through two factors. Such as Time and Space.

Time tells how long it will take to write an Algorithm, and from Space, it shows how much time we can write. Now, let’s talk about its characteristics.

  1. Unambiguous – Whatever algorithm you write, it is essential to be clear and unequivocal. Every step or line must have some meaning.
  2. Finiteness – Every Algorithm must be finished within a few tiny steps. And every effort should be Finite, i.e. limited bar Repeat. Execution of steps should also be for a limited time. Every action must have some meaning.
  3. Input – Every algorithm must have more than six steps than O or O.
  4. Output – Just as every Algorithm has an Input Step, so should the Algorithm’s Output Step. The work should also come to that for which we are written.
  5. Effectiveness – Effectiveness is estimated from time and space. Suppose the algorithm is written in a short time and space. Or execute in a short time and run in less space is called Effectiveness.

According to the data structure, all these should be essential categories.

  • Search -the item can be easily searched in the DATA structure.
  • Sort – Order a list or do Sorting.
  • Insert – Insert the algorithm into the data structure.
  • Update – Have the fame to update the item through AlGORITHM.
  • Delete – Delete the item data structure from the Algorithm by not causing any inconvenience.

The complexity of Algorithm

The Algorithm’s complexity has been classified, considering two factors: one Time Complexity and the other Space Complexity.

Time Complexity: The
time it takes for the program to run.

Space Complexity: The
space required to execute the program inside the computer is called Space Complexity.

How to write an algorithm

It is effortless to write it; you do not need to learn much. You would know that there was an example in Suruwat where one can make ex-the tea.

In the same way, you have to write Step by Step. More algorithms are needed in Programming. You can also write Director you can also write using some rules.

Rules: Start, Input, Output, Read, Variable, Display, Stop. Take a look at the example given below, which you will find easy to understand.

Example: 1

Q1. Enter two numbers and remove the sum of both the numbers.

  1. Each algorithm has Start and End Write Stop / End as below.
    After this, see how many Variables are required or what to input. For example, to sum the two numbers below, 3 Variables are needed. Num1 for the first number, Num2 for the second and sum variables Num1 + num2 for storing. So you should think about these variables and start writing.
  2. Now there will be some steps where we have to do Arithmetic Operation like +, -, ×, ÷ and some logical operation like Comparision Operation, True False, Output O (false) and 1 (True). You know Arithmetic (+, -, ×, ÷), and you have to know as an example of Logical. “Largest Number among 2 Number”, so here you will compare both numbers. Using these symbols, “>, <,> =, <=,! =”.
  3. Now finally, the result that comes, you can display it by writing Display and in the last step write Stop or End. Now understand this example carefully.

Step 1 : Start  // Step started

Step 2: Declare variables num1, num2 and sum.   // Create num1, num2, sum variable where any number will be stored

Step 3: Read values num1 and num2.     //If the number is entered from the keyboard, it will be read

Step 4: Add num1 and num2 and assign the result to sum.
Sum=num1+num2  //two numbers to add, Store it in Sum

Step 5: Display sum    //Display Sum

Step 6 : Stop // Finish

Now try to understand by looking at some more examples.

Example: 2

Step 1. Start
Step 2. Read the number n
Step 3. [Initialize] i=1, fact=1
Step 4. Repeat step 4 through 6 until i=n
Step 5. fact=fact*i
Step 6. i=i+1
Step 7. Print fact
Step 8. Stop

What did you learn today

I always try to ensure that you get the correct and accurate, and complete information. I hope you have understood what the algorithm is (Algorithm).

Perhaps the next time you write, remember these few things – how many variables you want in the program and what to do Compute. Which cone has to be operated. Which will be easy to write. Those who do the hard work never lose.

I hope this is from you; you must have liked this article, how did you feel. If you want to ask any question now, then please write in the comment box below. If you’re going to give any suggestion or advice, then definitely give it very useful for us.

If you have not subscribed to our blog yet, then definitely subscribe; you will get the information first.

Leave a Reply
Previous Post
What is GiGabyte Size

What is GiGabyte and its History – Difference Between GB and MB

Next Post
What is Emoji

What is Emoji and How To Make Your Own Emoji?