tutor.org.in

Free preview · Reading · 45 min

Decomposition, abstraction and algorithms

Computer Science · Computational thinking

In this lesson

  • Break a problem into smaller parts
  • Write an algorithm as numbered steps

Explanation

Computational thinking breaks a problem into parts (decomposition), ignores irrelevant detail (abstraction), spots patterns and writes precise steps (an algorithm). A good algorithm is unambiguous, finite and handles unusual inputs.

Worked example

Finding the largest of n numbers: set max to the first number; for each remaining number, if it is larger than max, set max to it; report max.

Practice

Write algorithms for: (a) counting vowels in a sentence, (b) checking whether a year is a leap year (divisible by 4, except centuries not divisible by 400).

Continue in the learning spaceEnrol to open every lesson, track your progress, hand in work for faculty review and ask your tutor.Enrol — One-to-One