* @brief Helper method for update method below * @param i The index of the current node * @param l The leftmost node of the current node * @param r The rightmost node of the current node * @param pos The position to update * @param val The value to update it to */