Types of algorithms, ways to present them and practice
Answers are for parents and teachers.
1
Present the algorithm for the fuel a car uses on a trip in words and as a flowchart: the distance s (km) and the use per 100 km q (litres) are input, V = s · q / 100.
In words: start; input s and q; compute V = s · q / 100; output V; end. Flowchart: oval → parallelogram (s, q) → rectangle (V) → parallelogram (V) → oval.
2
Write in words the algorithm for crossing the road at a pedestrian crossing with traffic lights. At which step is a condition checked?
For example: 1) go to the crossing and stop; 2) look at the traffic light; 3) if the light is green, look left and right and cross; otherwise wait for green and go back to step 2. The condition is checked at step 3.
3
Make a table of values for y = x² – 3 at x = –3, 0, 4 (write y).
6, –3, 13
4
An executor knows {+4; ×2; –3}. Write an algorithm that makes 17 from 3.
×2, +4, ×2, –3: 3 → 6 → 10 → 20 → 17.