import sys
sys.path.append('../linked_list')
from linked_list import LinkedList

class Queue:
  def __init__(self):
    self.size = 0
    self.storage = LinkedList()

  def enqueue(self, item):
    # queue an item up to be added to the tail and increase size accordingly
    self.storage.add_to_tail(item)
    self.size += 1
  
  def dequeue(self):
    # remove the head node by calling remove_head() and decrement size if possible
    dq = self.storage.remove_head()
    if self.size > 0:
      self.size -= 1
    return dq

  def len(self):
    return self.size
