Algorithms, Decomposition & Abstraction Flashcards
All 6 cards in this deck
What is abstraction?
The process of removing unnecessary detail from a problem, so only the details needed to solve it remain.
What is decomposition?
Breaking a problem into a number of sub-problems, so that each sub-problem accomplishes an identifiable task, which might itself be further subdivided.
e.g. a quiz program splits into: store questions, ask questions, check answers, keep score.In a route-planning app, give one detail abstraction keeps and one it removes.
Keeps: roads and distances between places. Removes: colours of buildings, names of shops, scenery.
True or false? Abstraction means breaking a problem into smaller sub-problems.
False. That is decomposition; abstraction is removing unnecessary detail.
What is an algorithm?
A sequence of steps that can be followed to complete a task. A program is an implementation of an algorithm.
When decomposing a problem, when do you stop breaking a sub-problem down?
When each sub-problem accomplishes one identifiable task, simple enough to be written as a single subroutine.