WEIGHT: 58 kg
Breast: Large
One HOUR:70$
Overnight: +70$
Services: Uniforms, Golden shower (out), Striptease, Slave, Golden shower (out)
A nice young man wrote about working on an algorithm problem after being inspired to think thusly by his new copy of The Algorithm Design Manual. Coincidentally, I recently received my copy of the book as well.
I was less inspired than Mr. I thank him for presenting his interview question, because that got me to thinking yesterday morning. How would I find the median element of the merger of two sorted lists without actually doing a linear merge? I contemplated trying to explain it to them, but I decided against it.
Over the course of the explanation they would certainly concoct a variety of theories about why I was trying to punish them in such a strange and tedious way. I went around in confused circles for a while before hitting upon what I think to be a good way to view the problem. Thus I know exactly where the median value will be in the result. For any index i in the merged list, all I can say is that the value will be from either a or b. Now, there are a few cheap things I can do to examine my lists.
So, for example, I can look at the median of either source list, or at the first element, or the last. Another thing I can do, less cheaply, is to find where a number would go in one of the source lists.
If I take at the smaller of the two last values in my source lists that is, a last and b last , and then find where it would go in the other list, I now know something really interesting: I know exactly what values occupy the positions at the end of the merged list!