📘 CodingMarble Learn

Introduction to Problem Solving

Problem solving on a computer has stages: analyse the problem (inputs, outputs, rules), develop an algorithm (a finite, clear, ordered set of steps), code it in a programming language, test it with different inputs, and debug (find and remove errors). An algorithm can be shown as a flowchart (oval = start/stop, parallelogram = input/output, rectangle = process, diamond = decision, arrows = flow) or as pseudocode (structured plain English). Decomposition breaks a big problem into smaller sub-problems that are solved separately and then joined.

🎬 Step-by-step story

  1. Solving a problem has five stages: analyse, write an algorithm, code, test and debug.
  2. Decomposition means breaking a big problem into small parts. Solve each part, then join them.
  3. Flowcharts use shapes. Oval is start or stop. Parallelogram is input or output. Rectangle is a process. Diamond is a decision.
  4. Here is a flowchart to print the larger of A and B. The token follows the YES path because 7 is more than 4.
  5. Pseudocode writes the same steps in simple English, one line at a time.
  6. Your turn: choose A and B. Watch which path the token takes.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why write an algorithm before coding?

Thinking out the steps first means you code the right idea. Fixing a plan is much easier than fixing a big program.

Is decomposition only for big software?

No. Even a small program is easier when split into input, process and output parts.

Why does a decision need a diamond?

The diamond shows a yes/no question with two exits. A rectangle has only one exit, so it cannot branch.

What happens when A equals B?

A > B is false, so the token takes the NO path and prints B, which is the same value. Try it in free play.

Flowchart or pseudocode: which is better?

Flowcharts are easier to see for small problems; pseudocode is quicker to write and closer to real code for larger ones.

Steps of problem solving

  1. Analyse the problem: understand what is given (input), what is wanted (output) and the rules.
  2. Develop an algorithm: write the solution as clear, ordered steps.
  3. Code: turn the algorithm into a program in a language like Python.
  4. Test: run it with many inputs, including edge cases (0, negative numbers, very large values).
  5. Debug: find and fix errors; then test again.

An algorithm must have: clear input and output, finite steps (it must stop), precise (unambiguous) steps, and it must give the correct result.

Flowcharts

A flowchart is a picture of an algorithm using standard symbols joined by arrows.

Flowcharts are easy to understand visually, but become large for big problems.

Pseudocode

Pseudocode writes an algorithm in simple English-like statements with keywords like INPUT, COMPUTE, PRINT, IF…ELSE, WHILE. It is not a real language, so it ignores exact syntax.

INPUT A, B
IF A > B THEN
    PRINT A
ELSE
    PRINT B

Algorithms can have sequence (steps one after another), selection (IF decisions) and repetition (loops).

Decomposition

Decomposition means breaking a complex problem into smaller, simpler sub-problems. Each part is solved (often by a different person or function) and then combined.

Example: a railway reservation system decomposes into: search trains, check seats, book ticket, take payment, print ticket.

Benefits: easier to understand, work can be shared, errors are easier to find, parts can be reused.

Board exam focus

Expect: draw a flowchart or write pseudocode for simple tasks (larger of numbers, sum of first n numbers, even/odd, grade from marks), name symbols, list the steps of problem solving, and explain decomposition with an example.

Key formulas and definitions

Worked examples

1. Write an algorithm to find the area of a rectangle.

1. Start. 2. Input length L and breadth B. 3. Area = L × B. 4. Print Area. 5. Stop.

2. Write pseudocode to check if a number is even or odd.

INPUT N IF N MOD 2 = 0 THEN PRINT "Even" ELSE PRINT "Odd"

3. Describe a flowchart to print the sum of numbers from 1 to 10.

Start → process: sum = 0, i = 1 → decision: i <= 10? → Yes: process sum = sum + i, i = i + 1, arrow back to the decision → No: output sum → Stop.

4. Decompose 'run a school sports day'.

Sub-problems: list events, register students, arrange ground and equipment, schedule, judge and record results, give prizes. Each can be handled by a team and joined.

5. Trace the larger-number flowchart for A = 5, B = 12.

Start → input A = 5, B = 12 → is 5 > 12? No → print B = 12 → Stop.

6. Write pseudocode to print the grade: marks ≥ 90 → A, ≥ 75 → B, else C.

INPUT M IF M >= 90 THEN PRINT "A" ELSE IF M >= 75 THEN PRINT "B" ELSE PRINT "C"

Common mistakes

Practice quiz

1. Which symbol is used for a decision in a flowchart?
2. Finding and removing errors is called:
3. An algorithm must be:
4. Input and output in a flowchart use a:
5. Breaking a problem into smaller parts is:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What are the steps of problem solving in Class 11 CS?

Analyse the problem, develop an algorithm, code it, test it and debug it.

What is the difference between an algorithm and a flowchart?

An algorithm is the step-by-step solution written in words; a flowchart is a diagram of the same steps using symbols.

What is decomposition?

Breaking a complex problem into smaller sub-problems that are solved separately and then combined.

Where this is taught

Canada (Ontario)Grade 10C. Programming
Canada (Ontario)Grade 11B. Software Development
Canada (Ontario)Grade 11B. Software Development
ItalySecondaria di secondo grado – classe 1ªComputer basics and programming
ItalySecondaria di secondo grado – classe 1ªElements of computer science
ItalySecondaria di secondo grado – classe 1ªElements of computer science
ItalySecondaria di secondo grado – classe 1ªElements of computer science
ItalySecondaria di secondo grado – classe 2ªComputer basics and programming
ItalySecondaria di secondo grado – classe 2ªElements of computer science
ItalySecondaria di secondo grado – classe 2ªElements of computer science
ItalySecondaria di secondo grado – classe 2ªElements of computer science
NetherlandsVWO 3 (onderbouw)Mathematical thinking
NetherlandsHAVO 4 (bovenbouw, 2e fase)Foundations
NetherlandsVWO 4 (bovenbouw, 2e fase)Foundations
PolandLiceum ogólnokształcące, klasa IUnderstanding, analysing and solving problems
PolandLiceum ogólnokształcące, klasa IIIDesigning and programming algorithms (I + II)
RomaniaClasa a VIII-aAlgorithms
RomaniaClasa a IX-aMilitary profile (mathematics-informatics, military)
RomaniaClasa a X-aFundamental algorithms on arrays
Spain2º ESOComputational thinking, programming and robotics
Spain3º ESOComputational thinking, programming and robotics
Spain1º BachilleratoAlgebraic Sense
Spain1º BachilleratoAlgebraic Sense
Spain1º BachilleratoAlgebraic sense and computational thinking
CBSE (India)Class 11Computational Thinking and Programming - 1
England (GCSE, A level)Year 103.1 Fundamentals of algorithms
USA (Common Core, NGSS, AP)Grade 8Algorithms and Programming
USA (Common Core, NGSS, AP)Grade 9Algorithms and Programming
USA (Common Core, NGSS, AP)Grade 10Big Idea 3: Algorithms and Programming
USA (Common Core, NGSS, AP)Grade 11Algorithms and Programming
Japan高校(専門学科)1〜3年Programming
Japan高校(専門学科)1〜3年Programming Technology
South Korea중학교 2학년Algorithms and programming
South Korea중학교 3학년Abstraction and algorithms
South Korea고등학교 3학년Abstraction and algorithms
FrancePremièreAlgorithms
FranceTerminaleAlgorithms
FranceTerminaleSpecific option — management information systems
Russia7 классAlgorithms and programming
Russia8 классAlgorithms and programming
Russia10 классAlgorithms and programming
China高一Comp.1 Ch.2 Algorithms and programs

Learn next

Related lessons

All Computer Science lessons