Develop an algorithm using either pseudo-code or a flowchart that will move every cargo container from Bay 0 to Bay 2.
Your algorithm must work regardless of how many containers are initially stacked in Bay 0. You can assume there will always be at least one container in Bay 0 at the start, and that Bay 1 and Bay 2 are completely empty.
The vertical order of the containers must be preserved in the final stack.
You must use the following subroutines in your solution:
MOVE_CONTAINER(source, destination): Moves the top container from the source bay and places it on top of the stack in the destination bay.GET_HEIGHT(bay): Returns the number of containers currently stacked in the specified bay.For example, if the starting arrangement is:
Then the final arrangement should have Container [B] stacked on top of Container [A] in Bay 2, with Bay 0 and Bay 1 being empty.
208 exam-style questions on AQA GCSE Computer Science Representing algorithms. Each one has a worked solution and a mark scheme showing where the marks go.