148ms Python solution, Binary Indexed Tree
Use self.c to represent Binary Indexed Tree. Section sums are stored in self.c[1..len(nums)]. x & -x is lowbit function, which will return x's rightmost bit 1, 
Use `self.c` to represent Binary Indexed Tree. Section sums are stored in `self.c[1..len(nums)]`. `x & -x` is `lowbit` function, which will return x's rightmost bit 1, e.g. lowbit(7) = 1, lowbit(20) = 4.\n\nself.c[1] = nums[0]\n\nself.c[2] = nums[0] + nums[1]\n\nself.c[3] = nums[2]\n\nself.c[4] = nums[0] + nums[1] + nums[2] + nums[3]\n\nself.c[5] = nums[4]\n\nself.c[6] = nums[4] + nums[5]\n\nself.c[7] = nums[6]\n\nself.c[8] = nums[0] + nums[1] + nums[2] + nums[3] + nums[4] + nums[5] + nums[6] + nums[7]\n\n    class NumArray(object):\n        def __init__(self, nums):\n            self.n = len(nums)\n            self.a, self.c = nums, [0] * (self.n + 1)\n            for i in range(self.n):\n                k = i + 1\n                while k <= self.n:\n                    self.c[k] += nums[i]\n                    k += (k & -k)\n    \n        def update(self, i, val):\n            diff, self.a[i] = val - self.a[i], val\n            i += 1\n            while i <= self.n:\n                self.c[i] += diff\n                i += (i & -i)\n    \n        def sumRange(self, i, j):\n            res, j = 0, j + 1\n            while j:\n                res += self.c[j]\n                j -= (j & -j)\n            while i:\n                res -= self.c[i]\n                i -= (i & -i)\n            return res
['Binary Tree', 'Python']