Interview Questions

  • View all interview questions
  • blank
  • Implement a queue using a linked list
    A queue is an abstract data structure where items can either be added to a collection or removed from a collection, enqueuing and dequeuing, respectively. A queue is similar to a physical line of people: people can be added to the end of the line (enqueuing), and to make the line smaller, people are removed from the front of the line (dequeuing). We're going to implement a queue using a linked list and we'll be using some code we've written in a previous solution. Another term used to describe queues is FIFO, which stands for first in, first out. It is a data structure where the first elements added to the collection will be the first removed.


    We want our queue to have two methods, enqueue X, which will add element X to the end of the queue, and a dequeue method which will remove the current first item from the queue. We don't need to specify what we want to dequeue because the method always returns the first element from the queue. Here is an example of a few operations we want our queue to be able to perform.

    You need to be a premium member to see the rest of this question and code.

    Become a Premium Member

    With our large collection of challengs, tutorials, and solutions, we make it easy for you to become a better coder, prepare for interviews, and learn new skills from more experienced coders.

    “I got my App Academy acceptance yesterday, and Coderbyte was definitely a huge help.” ― Tomer
    • 200+ Coding Challenges
    • Mock Interview Questions
    • 500,000+ Code Solutions
    • Algorithm Tutorials
    • Interview Prep Courses
    mrdaniel published this on 11/24/15 | linked list, queue
    Login to submit a comment