Example #1
0
class Queue:
  def __init__(self):
    self.storage = Linkedlist()

  def enqueue(self, item):
    self.storage.add_to_tail(item)

  def dequeue(self):
    return self.storage.remove_head()

  def is_empty(self):
    return self.storage.head == None
Example #2
0
class Stack:

  def __init__(self):
    self.storage = Linkedlist()

  def push(self, item):
    self.storage.add_to_head(item)

  def pop(self):
    return self.storage.remove_head()

  def isEmpty(self):
    return self.storage.head == None