Python simple solutions
Insertion Sort using binary search\npython\nclass MedianFinder:\n\n    def __init__(self):\n        """\n        initialize your data structure here.\n        "
Insertion Sort using binary search\n```python\nclass MedianFinder:\n\n    def __init__(self):\n        """\n        initialize your data structure here.\n        """\n        self.nums = []\n        \n    def addNum(self, num: int) -> None:\n        if not self.nums:\n            self.nums.append(num)\n            return \n        l = 0\n        r = len(self.nums)-1\n        while l < r:\n            m = (l+r)//2\n            if self.nums[m] == num:\n                self.nums.insert(m,num)\n                return \n            elif self.nums[m] < num:\n                l = m+1\n            else:\n                r = m-1      \n        if self.nums[l] < num:\n            self.nums.insert(l+1,num)\n        else:\n            self.nums.insert(l,num)\n\n    def findMedian(self) -> float:\n        mid = (0 + len(self.nums)-1 )//2\n        if (len(self.nums)-1) & 1:\n            return (self.nums[mid] + self.nums[mid+1])/2\n        else:\n            return self.nums[mid]\n```\nTwo Heaps\uFF1A\nThe length of smaller half is kept to be n / 2 at all time and the length of the larger half is either n / 2 or n / 2 + 1 depend on n\'s parity.\n```python\nclass MedianFinder:\n\n    def __init__(self):\n        """\n        initialize your data structure here.\n        """\n        import heapq\n        self.small = [] # maxheap\n        self.large = [] # minheap\n        \n    def addNum(self, num: int) -> None:\n        if len(self.small) == len(self.large):\n            heapq.heappush(self.small,-num)\n            tmp = heapq.heappop(self.small)\n            heapq.heappush(self.large,-tmp)\n        else:\n            heapq.heappush(self.large,num)\n            tmp = heapq.heappop(self.large)\n            heapq.heappush(self.small,-tmp)\n                \n                \n    def findMedian(self) -> float:\n        if len(self.small) == len(self.large):\n            return (-self.small[0] + self.large[0])/2\n        else:\n            return self.large[0]\n```
['Binary Search', 'Heap (Priority Queue)', 'Python3']