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

Algorithms Lecture Notes

The document provides an overview of algorithms, defining them as step-by-step procedures for problem-solving. It outlines characteristics of good algorithms, their structure, and provides real-life and programming examples. Additionally, it discusses types of algorithms and emphasizes their importance in programming for efficiency and problem-solving.

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 PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Algorithms Lecture Notes

The document provides an overview of algorithms, defining them as step-by-step procedures for problem-solving. It outlines characteristics of good algorithms, their structure, and provides real-life and programming examples. Additionally, it discusses types of algorithms and emphasizes their importance in programming for efficiency and problem-solving.

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 PDF, TXT or read online on Scribd

Lecture Notes: Algorithms

1. What is an Algorithm?

An algorithm is a step-by-step procedure used to solve a problem.

2. Relationship (Problem Solving → Algorithm)

Problem solving is thinking, while algorithm is writing those thoughts into steps.

3. Characteristics of a Good Algorithm

- Clear

- Finite

- Has input

- Has output

- Efficient

4. Structure of an Algorithm

- Start

- Input

- Process

- Output

- End

5. Real-Life Examples

Tea Making: Boil water → Add tea → Add sugar → Add milk → Serve

Morning Routine: Wake up → Brush → Bath → Dress → Breakfast

Mobile Unlock: Press button → Enter password → Unlock

6. Programming Examples

Addition: Input A,B → Sum = A+B → Output

Average: Input A,B,C → Avg = (A+B+C)/3


Even/Odd: If number %2==0 → Even else Odd

Largest: If A>B → A else B

7. Types of Algorithms

- Sequential

- Decision-Based

- Loop-Based

8. Importance of Algorithms

- Foundation of programming

- Makes problems easier

- Saves time and effort

- Provides efficient solutions

Final Thought:

A good programmer first designs a clear algorithm before coding.

You might also like