Designing & Analyzing Algorithms
High-Grade Assignment (Step-by-Step Professional Guide)
1. Introduction
An algorithm is a step-by-step procedure used to solve a problem efficiently. Professional computer
scientists focus not only on correctness but also on performance, scalability, and optimization.
2. Algorithm Design Phase
• Understand Problem: Define input and output clearly.
• Model Problem: Convert into mathematical or logical form.
• Check Constraints: Consider memory and time limits.
• Choose Strategy: Divide & Conquer, Greedy, or DP.
• Select Data Structure: Array, Tree, Graph, Hash Table.
• Write Pseudocode: Plan logic before coding.
Example Problem
Find the largest number in a list. Input: [3, 9, 2, 7]. Output: 9. We scan each element and keep track
of the maximum value.
Pseudocode:
max = first element
for each number in list:
if number > max → update max
return max
3. Design Flow Diagram
Start Problem
Understand Input
Choose Strategy
Write Pseudocode
Finish
4. Algorithm Analysis
• Correctness: Algorithm must always produce correct output.
• Time Complexity: Measure speed using Big-O notation.
• Space Complexity: Measure memory usage.
• Optimization: Improve efficiency if performance is poor.
Common Time Complexities
Notation Meaning
O(1) Constant time
O(n) Linear time
O(n²) Quadratic time
O(log n) Logarithmic time