Queue Data Structure

First In First Out (FIFO)

Basic operations:

  • enqueue (or push)
  • dequeue (or pop)

Keeping two references:

  • front
  • back

Two Ways of Implementations using

  • singly linked list
  • circular arrays

Implementation using Linked List

Pointers: list_head list_tail

Operations:

  • Find
  • Insert
  • Erase
template <typename Type>
class Single_list {
    public:
        int size() const;
        bool empty() const;
        Type front() const;
        Type back() const;
        Single_node<Type> *head() const;
        Single_node<Type> *tail() const;
        int count( Type const & ) const;

        void push_front( Type const & );
        void push_back( Type const & );
        Type pop
}
class Queue{
    private:
        Single_list<Type> list;

    public:
        bool empty() const;
        Type front() const;
        void push(Type const &);
        Type pop();
}

In [ ]: