What are Algorithms and Flowcharts?

Hello Friends,

Welcome to the world of problem-solving with Algorithms and Flowcharts! These two essential tools are like a roadmap for computers, guiding them in making decisions and solving puzzles step by step. In this article, we’ll explore what Algorithms and Flowcharts are all about and how they help simplify complex tasks, making them accessible to both machines and humans. So, let’s dive into the fascinating world of Algorithms and Flowcharts to unravel their significance in problem-solving.

 

ALGORITHMS

WHAT ARE ALGORITHMS?

  • It is a series of instructions to perform a task.
  • It is the step-by-step solution (process/procedure).

How to solve any problem?

  • Know the problem
  • Analyse the problem
  • Find the best solution, i.e. the easiest solution having less steps, precise and unique.

 

Finally, algorithm is a step-by-step process to obtain a solution for a specific task when executed. The most efficient algorithm is chosen based on the solution, the solving time and the amount of space used by an algorithm.

 

Advantages of algorithm

  1. Doesn’t use programming terminology, so easy to understand
  2. If any error, it can easily be identified and solved
  3. Independent of any programming language, and everyone is eligible to make an algorithm

 

Disadvantages of algorithm

  1. Solutions of complex problems cannot be made an algorithm easily
  2. Time consuming
  3. Difficult to explain loop concepts (repetition)

 

Criteria of algorithm

  1. The steps should be in sequence.
  2. Steps can include mathematical expressions.
  3. Variable can be used (to store values of input, intermediate and final result).
  4. The words ‘read’ and ‘print’ are ideally used in place of input and output.
  5. Any step can be repeated any number of times; or the number of repetitions can be specified to reduce the number of steps.
  6. Decision is made using a condition, using if-else statements.
  7. Output can be numerical, Boolean, a line of text, etc.
  8. The best solution must be selected from the number of solutions to a given problem, and should be stated as an algorithm.

 

Steps to develop an algorithm

  1. Problem description – The problem to be solved must be easy to understand.
  2. Analyse the problem – Decide the type of input, output and problem by listing the characteristics (decide whether: the solution is numerical, etc; the solution is a single value or multiple value; the problem requires a formula or not).
  3. Develop algorithm (process of solving) – Write the step-by-step solution.
  4. Test the algorithm – check each step and the final output and determine it has performed the intended operation.
  5. Review the algorithm – checking for changes, more simplifications, solves problem based on the analysed problem, etc.

 

CHARACTERISTICS OF ALGORITHMS – IODFU

  • I – Input – There can be zero or more quantities as input.
  • O – Output – There should be at least one output.
  • D – Definiteness – Each instruction should be clear and easy to understand.
  • F – Finiteness – There should be finite number of steps producing an output.
  • U – Unique – Each step should produce a unique result depending upon the input and the previous steps.

Pseudocode: a notation similar to any programming language but does not involve the complicated syntax of that programming language. Instead, structural conventions for the same are used (no machine-readable code, therefore easy to write and understand).

 

Also read:

 

EXAMPLES OF ALGORITHM

Write an algorithm to prepare maggi.

1. Take maggi, bowl, water and salt.

2. Take water in a bowl, add maggi and boil it for 2-5 minutes.

3. Add spices or vegetables according to your taste.

4. Cook it for 4-5 minutes.

5. Your maggi is ready!

 

Write an algorithm to add 2 numbers.

1. Take two numbers (a, b).

2. Calculate the sum (c = a + b).

3. Print the sum (c).

 

Write an algorithm to calculate the simple interest.

1. Input Principal, Rate and Time (P, R, T).

2. Calculate the simple interest ·(SI = (P*R*T)/100).

3. Print the Simple Interest (SI).

 

Write an algorithm to check whether a number is positive on negative.

1. Input a number (n).

2. Check if, n>0
If true, print “Positive no.” If false, print “Negative no.”

3. If n=0, print “zero”.

 

Write an algorithm to calculate the average of 3 numbers.

1. Input three numbers (a, b, c).

2. Calculate the average (Avg = (a+b+c)/3).

3. Print the average (Avg).

 

Write an algorithm to calculate and print the area and circumference of a circle.

1. Input the radius of a circle.

2. Calculate the area of the circle (A = 3.14*r*r).

3. Print Area (A).

4. Calculate the circumference of a circle (C = 2* 3.14* r).

5. Print the circumference (C).

 

Write an algorithm to input age and check whether the person is eligible to vote or not.

1. Input the аgе (a).

2. Check if, a>=18
If true, print “You can vote.” If false, print “You can not vote.”

 

Write an algorithm to input a number and check whether it is even or odd.

1. Input a number (n).

2. Check if, n%2=0
If true, print “Even no.” If false, print “Odd no.”

 

Write an algorithm to input three numbers and print the largest one.

1. Input three numbers (a, b, c).

2. Check if, a>b and a>c

If true, print a..
If false, go to step 3.

3. Check if, b>c and b>a.

If true, print b.
If false, print c.

 

Write an algorithm to check whether a number is Buzz or not.

INFO: BUZZ No. ends with 7, e.g. 797 or BUZZ no is divisible by 7, e.g. 70.

1. Read a number (n).

2. Check if, n%7=0 or n%10=7

3. If true, print n is a buzz no. If false, print n is not a buzz no.

 

Read more

HISTORY OF COMPUTERS | KnockLedge

HISTORY OF COMPUTERS | KnockLedge

History of Computers | KnockLedge Major Milestones | People Responsible for the development Hello Friends, In this post of history of computers | KnockLedge we get to know that the …

Read more

File Management | Organization of Data

File Management | Organization of Data Hello friends, In this article, File Management | Organization of Data, we get to know that managing your files, folders and drives is really …

Read more

error: Content is protected !!