![Introduction to Data Structures for Interviews](https://static.frontendmasters.com/assets/courses/2018-08-09-data-structures-interviews/thumb.webp)
Check out a free preview of the full Introduction to Data Structures for Interviews course
The "Queue Exercise" Lesson is part of the full, Introduction to Data Structures for Interviews course featured in this preview video. Here's what you'd learn in this lesson:
Bianca reviews the queue exercise prompt, including the constructor(), enqueue(), dequeue(), peek(), and expectations for implementing the Queue class.
Transcript from the "Queue Exercise" Lesson
[00:00:00]
>> Bianca Gandolfo: And then, we also have the queue prompt.
>> Bianca Gandolfo: And again, same thing, you can fork this, you can also save this wherever you want, whether it's in GitHub or what have you. So, same thing, so we have our constructor. Instead of push we call this enqueue, and that's just the standard language that we use when we talk about queues.
[00:00:34]
So stacks, push pop, queues, enqueue, dequeue. So enqueue is gonna add other value at the end, dequeue is gonna remove the value from the front, and then peek is just going to look at the next one that would be dequeued. So peek would for enqueue return the first and oldest, for the stack would be the last and newest.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops