class Queue:
# Circular List Implementation
DEFAULT_CAPACITY = 10
def __init__(self):
# instance variables: _data, _size, _front
self._data = [None]*Queue.DEFAULT_CAPACITY
self._front = 0
self._size = 0
def __str__(self):
# string representation of queue
pass
def __len__(self):
# return length of queue
return self._size
def is_empty(self):
# return True if queue is empty otherwise return False
return self._size == 0
def first(self):
# return first item of queue if it is not empty; otherwise return None
if self._size == 0:
return None
else:
self._data[self._front]
def dequeue(self):
# remove and return first item in queue; return None if queue is empty
def enqueue(self,e):
# add item e to the end of queue. If list is full, resize the list by
# creating a new list of twice the size and moving items from old list
# to new list; Do not forget to adjust _size and _front
def _resize(self,cap):
# method to resize
["ha"]*9
[None]*10