Queues

Projected Time

About 60-90 minutes

Prerequisites

Motivation

Queues are widely used both in programming and in real life. In programming: if you have an array of tasks to execute and not enough time to do them all as they come in, you’ll need some way to both track the tasks and execute them in the order they arrived. In real life: in line for a coffee, or on hold for customer support – there are many everyday scenarios that are real-life implementations of queues.

Application of queue in computer science:

Objectives

Participants will be able to:

Specific Things to Learn

Materials

Lesson

  1. Read through lesson slides Queue.
  2. Watch the video and read the article in the materials section.

Common Mistakes / Misconceptions

Guided Practice

Discuss as a group how a queue differs from other data structures already reviewed. Some suggested questions to consider:

Independent Practice

Implement a queue in JavaScript with a partner, keeping in mind all methods and helper methods that define a queue. Consider performance – what happens as you call specific methods you’ve defined?

Challenge

Search online with your partner for a way to implement a queue other than the one you just tried. Is this second implementation better? Why or why not?

Supplemental Materials

Check for Understanding

Share what you’ve learned and your implementation with another person.