0% found this document useful (0 votes)
1 views

Algorithm

An algorithm is a step-by-step set of instructions designed to solve a problem, similar to a recipe. Good algorithms are clear, finite, definite, correct, and efficient. They can be represented in plain text, flowcharts, or pseudocode, and come in various types such as searching, sorting, and mathematical algorithms.

Uploaded by

mehdiahabib0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Algorithm

An algorithm is a step-by-step set of instructions designed to solve a problem, similar to a recipe. Good algorithms are clear, finite, definite, correct, and efficient. They can be represented in plain text, flowcharts, or pseudocode, and come in various types such as searching, sorting, and mathematical algorithms.

Uploaded by

mehdiahabib0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Algorithms

1. What is an Algorithm
An algorithm is a step-by-step set of instructions to solve a problem
It is like a recipe that tells you exactly what to do in a specific order.

2. Characteristics of a Good Algorith


Clear and Simple: Easy to understand and follow
Finite Steps: The algorithm must end after a certain number of steps
Definite: Each step must be clear, with no confusion
Correct: It should solve the problem as expected
Efficient: It should use the least amount of time and resources.

3. How to Write an Algorithm


Write the steps to solve the problem in a logical order
Use simple and clear language.

Example:

Algorithm to make tea
Boil water
Add tea leaves to the boiling water
Add sugar and milk
Stir well
Strain and serve.

4. Representing Algorithm
Plain Text: Write the steps as a list (like in the tea example)
Flowchart: Use shapes and arrows to show the steps
Pseudocode: Write the steps in a simple coding-like language.

5. Examples of Algorithm
Find the largest number in a list
Start
Take a list of numbers
Compare each number to find the largest
Print the largest number
End
Check if a number is even or odd
Start
Input a number
If the number is divisible by 2, print "Even.
Otherwise, print "Odd.
End.

6. Types of Algorithm
Searching Algorithms: Find an item in a list
Example: Linear Search, Binary Search
Sorting Algorithms: Arrange items in a specific order
Example: Bubble Sort, Insertion Sort
Mathematical Algorithms: Solve mathematical problems
Example: Find the greatest common divisor (GCD).

You might also like