Problem Definition
• • Understand the problem clearly before
solving.
• • Identify Input, Process, and Output.
• Example:
• Input → two numbers
• Process → add them
• Output → display the sum.
Logical Reasoning
• • Thinking systematically to reach conclusions.
• Types:
• - Deductive: General → Specific
• - Inductive: Specific → General
Decomposition
• • Breaking large problems into smaller parts.
• Example:
• 1. Get marks
• 2. Calculate total
• 3. Compute average
• 4. Display result.
Software Design Concept of an
Algorithm
• • Algorithm = Step-by-step procedure to solve
a problem.
• Characteristics:
• - Unambiguous
• - Finite
• - Effective
• Example:
• 1. Start
• 2. Input A, B
Algorithm Representation
• • Ways to represent algorithms:
• 1. Natural language
• 2. Flowchart
• 3. Pseudocode
Algorithm Discovery
• • Process of finding or creating algorithms.
• Steps:
• 1. Understand problem
• 2. Design solution
• 3. Choose best method
• 4. Test and refine.
Iterative Structures (Loops)
• • Repeat steps until a condition is met.
• Types:
• - for loop
• - while loop
• - do-while loop
• Example:
• Sum of 5 numbers using for loop.
Recursive Structures
• • Function calling itself to solve sub-problems.
• Example:
• Factorial:
• fact(n)=1 if n=0
• fact(n)=n*fact(n-1) if n>0
Efficiency and Correctness
• • Efficiency: Time and space usage.
• • Correctness: Produces correct output for all
valid inputs.
Implementation of Algorithms
• 1. Convert algorithm to program.
• 2. Compile and run.
• 3. Test with inputs.
• 4. Debug errors.
Fundamental Algorithms
• Includes:
• 1. Exchanging values of two variables
• 2. Counting
• 3. Summation of numbers
• 4. Factorial computation
• 5. Fibonacci sequence
• 6. Reversing digits
• 7. Base conversion