0
0
Intro to Computingfundamentals~10 mins

Queues (first-in, first-out) in Intro to Computing - Draw & Build Visually

Choose your learning style9 modes available
Draw This - beginner

Draw a flowchart that shows how a queue works with the following steps: 1. Add three people named Alice, Bob, and Carol to the queue in that order. 2. Remove one person from the front of the queue. 3. Add one more person named Dave to the queue. 4. Remove two people from the front of the queue. Show the queue contents after each step.

10 minutes
Hint 1
Hint 2
Hint 3
Hint 4
Grading Criteria
Start and End symbols present
Actions for adding and removing people shown as rectangles
Arrows correctly show the flow from one step to the next
Queue contents shown after each add or remove action
Queue updates correctly reflect first-in, first-out order
Solution
Initialize empty queue
Add Alice to queue
Add Bob to queue
Add Carol to queue
Remove one person from front
Add Dave to queue
Remove one person from front
Remove one person from front

This flowchart starts with an empty queue.

Step 1: We add Alice, Bob, and Carol one by one. The queue grows as Alice, Bob, Carol.

Step 2: We remove one person from the front. Since Alice was first, she leaves. Queue is now Bob, Carol.

Step 3: We add Dave to the back. Queue is Bob, Carol, Dave.

Step 4: We remove two people from the front. Bob leaves first, then Carol. Queue is now Dave.

This shows the first-in, first-out behavior of queues clearly.

Variations - 2 Challenges
[intermediate] Draw a flowchart for a queue where you add four people (Anna, Ben, Cara, Dan) and then remove three people one by one, showing the queue after each step.
[advanced] Draw a flowchart for a queue that starts empty, adds two people, removes one, adds two more, then removes all remaining people one by one. Show the queue contents after each step.