0% found this document useful (0 votes)
7 views2 pages

Algorithms Notes Formatted

An algorithm is a logical, step-by-step procedure for solving problems, characterized by being finite, definite, input-driven, output-producing, and effective. It follows a basic structure of Start, Input, Process, Output, and End, with real-life examples like making tea and ATM withdrawals. While algorithms have advantages such as simplicity and language independence, they can also be time-consuming and lengthy.

Uploaded by

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

Algorithms Notes Formatted

An algorithm is a logical, step-by-step procedure for solving problems, characterized by being finite, definite, input-driven, output-producing, and effective. It follows a basic structure of Start, Input, Process, Output, and End, with real-life examples like making tea and ATM withdrawals. While algorithms have advantages such as simplicity and language independence, they can also be time-consuming and lengthy.

Uploaded by

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

Algorithm's Notes

1. What is an Algorithm?
An algorithm is a step-by-step procedure to solve a problem in a logical and finite way.

Simple words:

Algorithm = clear steps jo problem ko solve kare

2. Key Characteristics of an Algorithm


Finite → Must end after some steps
Definite → Steps must be clear
Input → Takes input
Output → Produces result
Effective → Steps are simple

3. Basic Structure of an Algorithm


Start → Input → Process → Output → End

4. Real Life Examples


Example 1: Making Tea

Start → Take water → Boil → Add tea → Add milk & sugar → Boil → Pour → End

Example 2: ATM Withdrawal

Start → Insert card → Enter PIN → Check → Enter amount → Check balance → Dispense cash
→ End

Conditional Statements
1. if Statement

Runs only if condition is true

2. if-else Statement

Two choices: true or false

3. else-if Statement

Multiple conditions checked one by one


Problems
Even or Odd
Largest of Two Numbers
Average of 4 Subjects
Positive/Negative/Zero
Biggest of 3 Numbers

Loop Example
Print numbers from 1 to 5 using loop

Advantages
Easy, Step-by-step, Language independent, Debugging help

Disadvantages
Time consuming, Not visual, Lengthy

Applications
Software, Apps, Websites, Banking, AI

You might also like