Stack Bash - Master data structures and algorithms

Implement a Queue using a linked list

Easy
Implement a queue using a linked list by finishing the class blueprint below.
Recall that a queue is a First in First out data structure.
Your queue has to implement the following methods:
  1. dequeue which will pop the next item from the queue
  2. enqueue which will add an item to the queue
  3. peek returns the item at the front of the queue.

Try it first

Solution

5 Essential Stacks & Queues Coding Interview Problems

Master Stacks & Queues by trying the coding challenges below.
  1. 1.Implement StackEasy
  2. 2.Implement QueueEasy
  3. 3.Max StackMedium
  4. 4.Valid ParenthesesMedium
  5. 5.Simplify PathMedium

Want to confidently pass your next coding interview?

Stack Bash helps new and veteran software engineers master data structures and algorithms for technical interviews.