April 26, 2024

What is Algorithm?

An Algorithm is a set of instructions for solving particular problems step by step. Its not only restricted to computer programming. Even in our daily life we will use algorithm. Feeling strange? Here is the example. You wanted to prepare tea. How you will prepare? You need to follow some steps. right ?
Take a container.
Add some water, milk, tea powder
Add Sugar (or add Jaggery :-))
Heat it for few minutes.

Purchase grocery from store.
Task 1: Have list of items to purchase.
Task 2: Take enough money to purchase the item.
Task 3: Take plastic container to carry the item from shop.
Task 4: Go to shop.
Task 5: Ask the grocery item one by one.
Task 6: Pay money to shop keeper.
Task 7: Take the grocery item and go to home.

Prepare a cake, Pizza everywhere we are using the algorithm.

So, Algorithm is a finite set of steps(or instructions) to solve a problem. For example, Add 2 numbers.
Get first number
Get Second number
Add these numbers and assign to “result” placeholder.
Display the result

You can write multiple algorithms to solve a particular problem. say, for example: sorting an array of data: There will be different way to sort the array.

Which programming language I need to use? It is up to you. You can use C, C++ or Java or any other programming language. Algorithm is independent of programming language.

Before jumping to flowcharts and C coding, its better to spend some time on writing algorithms for few problems. If I need to write algorithm for any problems, let me know in the comment section.

2 thoughts on “What is Algorithm?

Leave a Reply

Your email address will not be published. Required fields are marked *