Data Structures and Algorithms.
Data Structures and Algorithms.
Quiles
II – BSIT – D
Data Structures and Algorithms
Assignment # 2:
➢ Design an algorithm for the following problems using Pseudocode and
Flowcharts.
➢ Turn-in all your answers using MS Word or clear pictures of hand-written
answers.
1.Show the algorithm for computing the velocity of the car. Having the following inputs:
START
PSEUDOCODE:
Input D1, D2,
and T;
START
-Input the value of D1, D2, and T.
Compute the
Velocity -calculate the velocity using the formula.
END
2. Show the algorithm for computing the density of a given square. Use the following as
your inputs:
START
PSEUDOCODE:
D = M/V -Density=M/V
-Display the total density of the given
END
3. Show the algorithms for computing the greatest common divisor of two nonnegative
integers p and q as follows:
• If q is 0, the answer is p.
• If not, divide p by q and take the remainder r. The answer is the greatest
common divisor of p and q.
START
PSEUDOCODE:
YES END
Display “ The
answer is p”
END