[Python] Two Heaps
Explanation:\nodd = true is we have odd numbers.\nmed is the current median\n\nTime Complexity:\naddNum function O(logN)\nfindMedian function O(1)\n\nPython:\n\
**Explanation**:\n`odd = true` is we have odd numbers.\n`med` is the current median\n\n**Time Complexity**:\n`addNum` function `O(logN)`\n`findMedian` function `O(1)`\n\n**Python:**\n```\nclass MedianFinder(object):\n\n    def __init__(self):\n        self.med, self.odd, self.heaps = 0, 0, [[], []]\n\n    def addNum(self, x):\n        big, small = self.heaps\n        if self.odd:\n            heapq.heappush(big, max(x, self.med))\n            heapq.heappush(small, -min(x, self.med))\n            self.med = (big[0] - small[0]) / 2.0\n        else:\n            if x > self.med:\n                self.med = heapq.heappushpop(big, x)\n            else:\n                self.med = -heapq.heappushpop(small, -x)\n        self.odd ^= 1\n\n    def findMedian(self):\n        return self.med\n```\n
[]