

class Heap(object):
  """Implements a heap data structure in Python.

  The underlying data structure used to hold the data is an array.
  """

  __heap = []

  def __init__(self, initial=[]):
    """Creates a new heap.

    Args:
      initial: (Optional): A continguous array containing the data with which to
        initialize the new heap.
    """
    self.__heap = []



class Heap(object):
  """Implements a heap data structure in Python.

  The underlying data structure used to hold the data is an array.
  """

  __heap = []

  def __init__(self, initial=None):
    """Creates a new heap.

    Args:
      initial: (Optional): A continguous array containing the data with which to
        initialize the new heap.
    """
    if isinstance(initial, list) or isinstance(initial, tuple):
      self.__heap = initial

Fix massive bug in initialization
Fix massive bug in initialization

  
  
  class Heap(object):
    """Implements a heap data structure in Python.
  
    The underlying data structure used to hold the data is an array.
    """
  
    __heap = []
  
-   def __init__(self, initial=[]):
+   def __init__(self, initial=None):
      """Creates a new heap.
  
      Args:
        initial: (Optional): A continguous array containing the data with which to
          initialize the new heap.
      """
+     if isinstance(initial, list) or isinstance(initial, tuple):
-     self.__heap = []
+       self.__heap = initial
  
Fix massive bug in initialization
## Code Before:


class Heap(object):
  """Implements a heap data structure in Python.

  The underlying data structure used to hold the data is an array.
  """

  __heap = []

  def __init__(self, initial=[]):
    """Creates a new heap.

    Args:
      initial: (Optional): A continguous array containing the data with which to
        initialize the new heap.
    """
    self.__heap = []

## Instruction:
Fix massive bug in initialization
## Code After:


class Heap(object):
  """Implements a heap data structure in Python.

  The underlying data structure used to hold the data is an array.
  """

  __heap = []

  def __init__(self, initial=None):
    """Creates a new heap.

    Args:
      initial: (Optional): A continguous array containing the data with which to
        initialize the new heap.
    """
    if isinstance(initial, list) or isinstance(initial, tuple):
      self.__heap = initial
