60-90 minutes
- Lesson Slides: 15 min
- Medium Article: 15 min
- Video Materials: 10 min
- Group Discussion: 10 min
- Independent Practice: 30 min
- What is a Data Structure
- JavaScript 1 - Variables, Strings, & Integers
- JavaScript 2 - Arrays & Functions
- JavaScript 3 - Booleans, Conditionals, If/Else Statements
- JavaScript 4 - Loops
- JavaScript 5 - Functions
- JavaScript 6 - Object Literals
- JavaScript 7 - Object-Oriented Programming
- Runtime Complexity
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.
Participants will be able to:
- Understand when to use a queue
- Be familiar with common methods
- Implement a queue
- Find and use a queue library
- Discern performance tradeoffs for different implementations of a queue
- Properties of a queue
- Common use cases for queues
- Review of common implementation(s)
- Lesson Slides
- 15-20 min read: Medium - A Gentle Introduction to Data Structures: How Queues Work (freeCodeCamp)
- 10 min Video: Introduction to queues
- Review content from Lesson Slides.
- Watch the video and read the article in the materials section.
- There may be an implementation that is very simple, but untenable for larger queues.
Discuss as a group how a queue differs from other data structures already reviewed. Some suggested questions to consider:
- What are the methods a queue must have?
- What can be tracked in a queue?
- When would a queue be used?
- What other data structures are used to make a queue?
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?
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?
- Video: Queue concepts
- Video: Introduction to Queues
- 10 min Video: Queues Practical Use Case - Messaging
- tuts+ article: Data Structures With JavaScript: Stack and Queue
- Download a queues project and experiment: Kate Morley - JavaScript queues
Share what you've learned and your implementation with another person.