input: 
  class MedianFinder:
      def __init__(self):
          self._data = []
      
      def add(self, num):
          self._data.append(num)
      
      def find_median(self):
          data = sorted(self._data)
          n = len(data)
          return (data[(n-1)//2] + data[n//2])/2
  
  # Example usage:
  # mf = MedianFinder()
  # mf.add(3)
  # mf.add(1)
  # mf.add(2)
  # print(mf.find_median())  # Output: 2.0
  
output:     
          self._data.sort()
          n = len(self._data)
          if n % 2 == 1:
              return self._data[n//2]
          else:
              return (self._data[n//2 - 1] + self._data[n//2]) / 2
  