entries I wanted to write. This concerns a phone interview I had not too long ago in which I

was asked to give an algorithm for determining whether a number is a power of two. I was able

to think of one that runs in linear time (in the number of bits of the number) by starting off

with 1 and repeatedly left shifting it until you either get the number or hit the maximum

integer. The interviewer didn't ask for a faster algorithm.

I did try to think of a faster algorithm. Two ideas came to me. A power of two in binary

representation will have a one followed by only zeros (unless it's the number 1). If you

subtract one from it, you get a binary representation with all ones. I didn't link these two

concepts together to come up with a faster algorithm (bitwise ANDing the two numbers and

checking if the result is zero). I had actually seen this solution before, but didn't

remember it. But I had enough information to give a better answer without needing to remember

it, if only I'd been able to link the concepts together. (BTW, I read on one of the interview

practice sites that an interviewer was displeased when an interviewee gave a linear time

algorithm for this question.)

In general, this seems to be part of my problem solving problem. I'm able to get most of the

way towards a good solution, but will hit a point where I get stuck, even if I've come up with

enough information that can be linked or combined to give a great answer. So I have to resort

to a correct (but inelegant) answer. I think if I had been more consistent in linking ideas

and concepts in this way, I would have done better on tests in undergrad and grad school.

Some problem solving books I've read suggest breaking cryptograms. Looking for patterns and

rearranging letters supposedly helps the exercise the mind. When I was a kid, I used to have

puzzle books that featured anagrams, cryptograms, and other types of word puzzles. I remember

enjoying working on them, although I don't know offhand why I stopped. I think I spent most

of my time on them during summers before I started working summer jobs. Quite possibly, I

didn't have time for them any more while working.