# Tutor profile: Vinay R.

## Questions

### Subject: Spanish

1. Please translate the following sentence into Spanish: If I had said it during the meeting, my boss would have increased my salary. 2. Which of the following phrases means "as long as" or "provided that": A. tan pronto como B. con tal que C. en cuanto D. puesto que 3. Which of the following verbs means "to realize": A. darse cuenta B. realizar C. tener en cuenta D. predecir

1. Si lo hubiera dicho durante la junta, mi jefe me habría subido el sueldo. 2. B 3. A

### Subject: Computer Science (General)

Let's say that we have two arrays, of size $$m$$ and $$n$$ respectively where $$m \leq n$$. Find an integer that appears in both arrays (or report that no such integer exists). Use constant space, optimize runtime performance, and report the runtime.

The goal is to use constant space, and to have the runtime be $$m$$ log$$n$$ in the worst case. How can we go about doing this? The crux of what we should do is to sort the larger of the two arrays, then use binary search on it to look for duplicates. There are some things to think about however. Which sorting algorithm should we use? Let's think of several options: 1. Mergesort - this would require linear extra space to perform, thus does not meet our requirement of using constant space. 2. Quicksort - this would use logarithmic extra space for the recursion, and additionally does not have a linearithmic (n log n) runtime in the worst case. 3. Heapsort - This sort algorithm uses constant extra space, and also runs in linearithmic time, so we should choose this sorting algorithm. Now, after we have the array of size $$n$$ sorted, we will iterate through the array of size $$m$$, and for each element we will perform a binary search in the array of size $$n$$ to look for the element. If we don't find it, we will increment to the next element in the array and perform the search again. If we find a duplicate, return the duplicate. If we don't find it after traversing through the entire array, return that no such integer exists. The worst case runtime of such an algorithm is $$m$$ log$$n$$. This is because heapsorting takes $$n$$ log$$n$$ time, and binary searching takes log$$n$$ time, which is performed $$m$$ times by traversing through the array of size $$m$$. Also, why did we sort and binary search through the larger array? Consider when $$n$$ is significantly larger than $$m$$, say 1,000,000 and 100 respectively. In this case, $$m$$ log$$n$$ is equal to about 2000, while $$n$$ log$$m$$ is equal to about 6,640,000. Of course, this is using log base 2.

### Subject: Calculus

Solve for x: $$log_2(x+2)+log_2(x−1)=1$$

We can solve this problem by first applying the following log rule: $$log_b(MN) = log_b(M) + log_b(N)$$. Then, we can apply the above rule to the equation we have to solve: $$log_2(x+2)+log_2(x−1)= log_2((x+2)(x-1))$$ We know that the right side of this equation is equal to 1, because that was the definition of the equation given to us in the problem. So, $$log_2((x+2)(x-1)) = 1$$ The equation above can be re-written to get rid of the log by putting both sides as exponents to the number 2 as such: $$2^{log_2((x+2)(x-1))} = 2^1$$ This simplifies to: $$(x+2)(x-1) =2$$. Now, expanding the polynomial, we get $$x^2 + x - 2 = 2$$, or $$x^2 + x - 4 = 0$$, which we can plug directly into the quadratic formula to solve for $$x$$. After doing so, we can see that $$x$$ can equal one of the two following values: $$x = \frac{-1 + \sqrt{17}}{2} = 1.56155 $$ or $$x = \frac{-1 - \sqrt{17}}{2} = −2.56155$$. As we can see, if $$x = \frac{-1 - \sqrt{17}}{2}$$, then the value of $$x-1$$ would be negative. We cannot take the logarithm of a negative number, as would be done in $$log_2(x−1)$$ and $$log_2(x+2)$$. Therefore, the only solution for $$x$$ in this problem is $$\boxed{x = \frac{-1 + \sqrt{17}}{2} = 1.56155}$$ .