LearnWave
Learn it. Master it.

Introduction to Problem Solving

Coding and decomposition

Break a big problem into smaller ones.

Once the algorithm is final, it is coded in a programming language, following the language's syntax: its rules of spelling, word order and punctuation, like the grammar of a human language.

  • Machine language (only 0s and 1s) is understood directly by the computer, but is very hard for people to write and read.
  • High-level languages (FORTRAN, C, C++, Java, Python) are much easier for people, and portable (they can run on different machines). But they need a compiler or an interpreter to turn the source code into machine code.

The choice of language depends on the platform: a desktop, mobile or web application, or an embedded system inside a device such as a digital watch, a traffic signal or medical equipment.

Big problems are easier to solve in pieces. Decomposition ('divide and conquer') breaks a complex problem into smaller sub-problems. Each one is easier to solve, can be studied in detail, and can be solved independently, even by different teams at the same time.

For example, the railway reservation system (Figure 4.12) can be broken into: information about trains, reservations, staff and security, billing, food service, and other details. Once each part is solved, the parts are tested and integrated (joined together) into the complete system.

Divide and conquer.
Divide and conquer.

Practise this lesson

Questions that get harder as you improve, a Tutor that helps without giving the answer away, and progress you can see. Free for every learner.

No account, no email address. Opens the real product.