Representing algorithms

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
Question 7
Medium

The diagram shows how three component trays, P, Q, and R, are arranged at a robotic assembly line.

Initial arrangement of trays at the assembly stations

The command TRANSFER_TRAY(source, destination) moves the single topmost tray from the source station and places it on top of the stack at the destination station.

Determine the final arrangement of the trays at Station 1, Station 2, and Station 3 after the following algorithm has run:

  • TRANSFER_TRAY(1, 3)
  • TRANSFER_TRAY(1, 2)
  • TRANSFER_TRAY(3, 2)
  • TRANSFER_TRAY(1, 3)
  • TRANSFER_TRAY(2, 1)
[3]

Representing algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Representing algorithms