BOOK D1, PAGE 130
Flowchart Simulation: This interactive demo shows how the array P is built step by step. The algorithm starts with P[1]=1 and for each subsequent position, it either subtracts 5 (if the current value is ≥5) or multiplies by 3 (if less than 5). The final array is [1, 3, 9, 4, 12], with the largest value being 12 at P[5].
Array Negation: This demonstrates a simple loop that negates each element in an array (multiplies by -1). In forward mode, you see how the array transforms. In backward mode, you can enter the final array and see what the initial array must have been before negation.
Learning Objectives: Understand how algorithms process arrays step-by-step, learn how to trace values through iterations, and see how operations can be reversed when the transformation is known.