Steps#
- Analyse the problem (inputs, outputs, constraints).
- Develop an algorithm - a finite sequence of clear steps.
- Code it in a programming language.
- Test and debug.
Decomposition: break a big problem into smaller sub-problems (e.g. a railway reservation system → booking, payment, cancellation).
Representing algorithms#
- Flowchart symbols: oval (start/stop), parallelogram (input/output), rectangle (process), diamond (decision), arrows (flow).
- Pseudocode: English-like steps (INPUT, COMPUTE, IF … THEN, WHILE, PRINT).
INPUT a, b, c → IF a ≥ b AND a ≥ c THEN PRINT a ELSE IF b ≥ c THEN PRINT b ELSE PRINT c
एल्गोरिदम किसी समस्या को हल करने के स्पष्ट और सीमित चरणों का क्रम है। इसे फ़्लोचार्ट (चित्रों से) या स्यूडोकोड (सरल अंग्रेज़ी जैसे वाक्यों से) में दिखाया जाता है। बड़ी समस्या को छोटे भागों में तोड़ना 'डीकम्पोज़िशन' कहलाता है।
Errors#
| Error | Example |
|---|---|
| Syntax error | missing colon or bracket |
| Logical error | wrong formula - program runs but gives wrong output |
| Run-time error | division by zero, file not found |
Exam tips#
- Draw flowcharts for even/odd, largest of three, factorial and sum of n numbers.