text: """
  A stack is a data structure whose primary purpose is to store and
  return elements in Last In First Out order. 
  
  1. Implement the Stack class using an array as the underlying storage structure.
     Make sure the Stack tests pass.
  2. Re-implement the Stack class, this time using the linked list implementation
     as the underlying storage structure.
     Make sure the Stack tests pass.
  3. What is the difference between using an array vs. a linked list when 
     implementing a Stack?
  """
  from singly_linked_list import LinkedList
  
  
  class Stack:
      def __init__(self):
          self.size = 0
          # 1. use array as storage
          # self.storage = []
          # 2. use LinkedList as storage
          self.storage = LinkedList()
  
      def __len__(self):
          return self.size
  
      def push(self, value):
          # 1. use array as storage
          # self.size += 1
          # self.storage.append(value)
          # 2. use LinkedList as storage
          self.size += 1
          self.storage.add_to_tail(value)
  
      def pop(self):
          # 1. use array as storage
          # if self.size == 0:
          #     return None
          # else:
          #     self.size -= 1
          #     return self.storage.pop()
          # 2. use LinkedList as storage
          if self.size == 0:
              return None
          else:
              self.size -= 1
              return self.storage.remove_tail()
  