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

Introduction To Algorithm

The document introduces algorithms as finite sets of instructions designed to solve specific problems, emphasizing the importance of understanding algorithmic logic before coding. It discusses essential tools like pseudocode and flowcharts for planning and visualizing algorithms, as well as control structures such as sequence, selection, and repetition. The document highlights the significance of a top-down approach in problem-solving and the universal nature of algorithmic thinking across programming languages.

Uploaded by

menkae377
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 views10 pages

Introduction To Algorithm

The document introduces algorithms as finite sets of instructions designed to solve specific problems, emphasizing the importance of understanding algorithmic logic before coding. It discusses essential tools like pseudocode and flowcharts for planning and visualizing algorithms, as well as control structures such as sequence, selection, and repetition. The document highlights the significance of a top-down approach in problem-solving and the universal nature of algorithmic thinking across programming languages.

Uploaded by

menkae377
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

Introduction to Algorithms

The Art of Problem


Solving
Every piece of software you use — from a search engine to a video game —
is powered by algorithms. Learn to think like a problem solver before you
write a single line of code.
What Is an Algorithm?
Definition
A finite, unambiguous set of instructions designed to solve a
specific problem — always producing a result in a predictable
number of steps.

Core Components
Every algorithm has well-defined inputs, a sequence of operations,
and a clear, expected output. No ambiguity allowed.

The Origin
The word "algorithm" is derived from the name of the 9th-century
Persian mathematician Muhammad ibn Musa Al-Khawarizmi, father
of algebra.
Algorithm vs. Program
The Algorithm The Program
The abstract, language-independent logical solution to a The concrete implementation of that logic in a specific
problem. Think of it as a recipe — the idea of what to do, not programming language like Python, Java, or C++.
how to do it in a specific kitchen.

Designing the algorithm before coding prevents


logic errors and saves significant development
time.
Essential Tool: Pseudocode

What Is Pseudocode?
An informal, English-like description of program logic — readable by humans,
independent of any programming syntax.

Write logic before worrying Easier to review and refine with Maps out program flow and
about syntax teammates structure clearly
Essential Tool: Flowcharts
A flowchart is a visual blueprint of your algorithm using standardized symbols — making it easy to spot logical flaws before
writing code.

Arrow
Shows flow direction

Decision
Branch on condition

Process
Action or operation

Terminator
Start or end point

Each symbol has a precise meaning: ovals mark the start and end, rectangles represent actions, diamonds handle decisions,
and arrows show the direction of flow.

Flowcharts help teams communicate logic visually and catch errors early in the design phase.
Types of Control
Structures

Sequence Selection
Statements execute in order, If / if-else statements choose
one after another — the default different paths based on
flow of any program. conditions — enabling
decision-making.

Repetition
For and while loops repeat a block of code until a condition is met —
automating iterative tasks.
Practical Example: Adding Three Numbers
Pseudocode Flowchart Logic
01
START
DECLARE num1, num2, num3, sum Start — Begin the program
INPUT num1, num2, num3
sum ← num1 + num2 + num3 02
OUTPUT sum
Declare variables num1, num2, num3, sum
END

03

Input three values from the user

04

Calculate sum = num1 + num2 + num3

05

Output the result, then End


Pseudocode Example: Finding the Maximum
The Algorithm

SET max ← list[0]


FOR each element in list:
IF element > max:
max ← element
END FOR
RETURN max

How It Works
Assume the first element is the largest
Compare each remaining element to max
Update max whenever a larger value is found
Return the final maximum value
Design Philosophy: Top-Down Approach
Complex problems feel overwhelming — the key is to break them apart systematically until each piece is solvable.

Decompose
Break into smaller
modules

Define
Problem Refine & Solve
Understand the full Implement each
scope module fully

This stepwise refinement transforms a daunting challenge into manageable, testable components.

Modular Debuggable Reusable


Each piece can be developed and Errors are easier to isolate in smaller Solved components can be
tested independently. modules. repurposed in future projects.
From Logic to Reality
Algorithms Power Everything
From web search and social media to medical diagnostics —
algorithms are the heartbeat of modern technology.

Plan Before You Code


Pseudocode and flowcharts save significant development time by
catching logic errors before implementation.

Master the Logic First


Syntax changes with every language — but algorithmic thinking is
universal. Learn the logic, and the code will follow.

You might also like