Program Decomposition
Program Decomposition
The complex problem of the committed crime has now been broken down into
simpler problems that can be examined individually, in detail.
There are different methods used to design and construct a solution to a problem.
These include flowcharts, structure diagrams and pseudocodes.
FLOWCHARTS
Designing effective problem-solving flowcharts involves careful consideration of
various factors to ensure clarity, accuracy and usability. Here are some best
practices to create efficient and useful problem-solving flowcharts:
PSEUDO-CODE
This is a term which is often used in programming and algorithm-based fields. It
is a methodology that allows the programmer to represent the implementation
of an algorithm. Pseudocode literally means ‘fake code’. It is
an informal and contrived way of writing programs in which you represent the
sequence of actions and instructions (aka algorithms) in a way that humans can
easily understand.
The language of a computer is very rigid: you are not allowed to make any
mistakes or deviate from the rules, making it hard for an average human
developer to reason and create a program code. With pseudocode, however, it’s
the exact opposite. You make the rules. It doesn’t matter what language you use
to write your pseudocode. All that matters is comprehension.
In pseudocode, you don't have to think about semi-colons, curly braces, the
syntax for arrow functions, how to define promises, DOM methods and other core
language principles. You just have to be able to explain what you're thinking and
doing.
Advantages of Pseudocode
Improves the readability of any approach – it is one of the best approaches to
start implementation of an algorithm.
Acts as a bridge between the program and the algorithm or flowchart. Also
works as a rough documentation, so the program of one developer can be
understood easily when a pseudo code is written out. In industries, the
approach of documentation is essential. And that’s where a pseudo-code
proves vital.
The main goal of a pseudo-code is to explain what exactly each line of a
program should do, hence making the code construction phase easier for the
programmer.
Here are the steps you can follow to solving programming problems with
pseudocode:
If you fail to properly understand the question, you won’t be able to work through
the problem and figure out the possible steps to take. Once you identify the main
problem to be solved you'll be ready to tackle it.
It helps to represent these problem-solving steps in the clearest and most easily
understandable way you can – which is pseudo-code!
numberOne = 5
numberTwo = 2
print(lcmNaive(numberOne, numberTwo))