Your coding club needs 24 seats and a projector. Which room wastes the fewest seats?
Your school coding club needs a room with a projector and at least twenty-four seats. You want the room with the fewest spare seats. If the first room on the booking list fits, can you book it straight away?
Use the two jobs you already know how to separate. First, test whether a room is suitable: it needs at least twenty-four seats and a projector. Then compare the suitable rooms. Since the group size stays the same, fewer seats means fewer spare seats.
Start with no choice. Take each room in list order and test both requirements. If it's suitable, keep it if you have no choice or it has fewer seats than your choice. Keep the earlier room on a tie. When no entries remain, report your choice or say there's no suitable room.
Your current choice has thirty seats. The next room has twenty-six seats and a projector. What should you do now, while there are still rooms left to check? Pick one option.
An algorithm is a set of precise, ordered instructions that finishes. You can scan the list once, keeping the best room so far. Or a computer can sort by seat count, keeping ties in booking order. Check the sorted list until a room fits or the list ends. You can reuse that order.
Start with no choice. Room A has thirty seats and a projector, so keep it. Room B has twenty-four seats but no projector, so keep A. Room C has twenty-six seats and a projector, so switch to C. The list is finished, so report C.
Now all three rooms have projectors. D has thirty-two seats, E has twenty-five, and F has twenty-three. The club still needs at least twenty-four seats. Follow the rules in list order and pick the room the algorithm reports.
Start with no choice again. Room G has twenty-two seats and a projector, so it fails the seat test. Room H has twenty-eight seats but no projector, so it fails the projector test. Neither room becomes your choice. At the end, report that there's no suitable room.
If you write 'find the best room' and 'stop when found', someone might stop at the first suitable room and miss a better one. Say to keep the first suitable room, then replace it only with a suitable room with fewer seats. For this scan, stop at the end of the list.
For 'Construct an algorithm', start with no choice. For each room, check for at least twenty-four seats and a projector. If it passes, choose it if you have no choice or it has fewer seats than your choice. After the loop, output 'No suitable room' if no room passed. Otherwise, output your choice.