So I had an interview for an job yesterday. In fact, it was my first job interview. It went okay.
One of the technical questions the interviewer asked was to create a data structure that would insert in O(log n) and return an iterator that would iterate the data back in sorted order in O(n) time. I knew it was a binary tree and the iterator would use an inorder traversal of the tree so I started typing it out.
But when I got to the iterator part, I just couldn’t figure it out. I knew for sure it was an inorder traversal but I couldn’t figure out how to turn the recursive algorithm that I knew into an iterative one. So I sat there and drew some trees to try and visualize the algorithm for it. I thought using a stack for the traversal would also probably work but I couldn’t figure that out either. And then time was up.
So we continued the interview. I asked some questions about the position. Then the interview ended.
I hung around for a little bit with a friend that worked there and referred me for the job then we biked back to our dorms. As soon as I got back I opened up Visual Studio and worked on the problem again because I knew that if I didn’t I’d probably end up staying up all night thinking about it.
It figured it out in ten minutes.
Coding under pressure, man. Can’t do it.
From The Restaurant at the End of the Universe by Douglas Adams:
It is known that there is an infinite number of worlds, simply because there is an infinite amount of space for them to be in. However, not every one of them is inhabited. Therefore, there must be a finite number of inhabited worlds. Any finite number divided by infinity is as near to nothing as makes no odds, so the average population of all the planets in the universe can be said to be zero. From this it follows that the population of the universe is also zero, and that any people you may meet from time to time are merely the product of a deranged imagination.
If you have a Netflix account and you want to watch something that makes you feel like an insignificant speck of nothing, go watch Into the Universe with Stephen Hawking.
The last episode is especially depressing. In it, he talks about all the different ways everything can end. Black hole sucks us in. Asteroid comes by and blows us up. The sun runs out of fuel. Another galaxy crashes into ours.
While all that stuff won’t happen in my lifetime (probably), it made me think about all the awesome space things that I won’t be able to experience within my lifetime. Traveling to another habitable planet, for one.
It’s mind blowing just how insignificant we are in both size and time.
I’m currently watching the extended edition of the Lord of the Rings Trilogy. These are the longest freaking movies ever.