Sunday, December 27, 2009

Polyphasic Sleep Map

I just found this really nice map of polyphasic sleepers around the world. If you are trying to adopt polyphasic sleep, or are already deeply into it, please sign up and put your pin on the map.

I'm proud to say that Oregon is the only state other than California (as far as I can see) that has TWO people doing uberman. I think that's pretty cool. At the same time, I hope people become more aware of polyphasic sleep and play with it as their situations permit.

Uberman Sleep pattern

For about two years now I've been doing a sleep style called "polyphasic sleep". The two popular terms on the internet for it are Uberman and Everyman. Originally I started on Uberman and stayed on it for several months, but due to the psychological effects of being awake and alone for an extra 8 hours per day, I changed to an Everyman schedule. I sleep for 4.5 hours per night and take three 30min naps evenly spaced throughout the day.

Last week I went back to the Uberman pattern and things have been going good. Normally the transition to Uberman is truly killer, but my body is already used to taking naps and having a shortened core sleep period. It's been hard and I've fallen asleep on the couch a few times, but it's been manageable.

One of the things that has really helped me this time around is a Nintendo Wii and Wii Fit. My inlaws have it and when I get up from each nap during the night I get on the Wii and run through 30min of Wii Fit routines. When I do that my mind is awake and alert for the rest of the period until my next nap.

Another factor in my transition to Uberman this time around is that I've had 2 years to adjust to a milder version of the same psychological effects. I'm now comfortable working by myself for long hours on end in a low light environment. Feeling alone in your house is one thing, feeling alone in your entire timezone is another (I'm just saying that there are no appropriate locations open at 3am).

Post a comment if you'd like to know more, either on the blog or privately.

Thursday, December 03, 2009

Word pair matching challenge

In trolling the net I found a problem that I thought would be fun. It was posted by CitrusByte and is as follows: Given a dictionary, output all word pairs where both words share all their letters except the last two, which are distinct and reversed.

My solution is a bit long to post inline, but go check it out on github.

My first attempt kept all the words around while the first letter remained the same. It ran in 4 minutes using a ~450k words. This last implementation runs in 5 sec on the same list. Yea! I was surprised too. Just goes to show that you don't always understand the real nature of your data until you test it.

The reason for the speed up it drawn on my board in pictures and diagrams, but I'll try to explain it. When the list of words we can check against is sorted, and our list of possible matches is sorted, when we have passed a given word (represented by the current word being greater than the given word) there is no possibility of a match existing so we can remove the word from the list.

If we are only considering words of the same length in a given list and we remove all words that we have passed, then the word we are looking for should be on top if it is in the list at all. Remember this is using a sorted list of matches. We have to resort the list each time we add an item, but resorting the list each time isn't too bad because the lists stay very small.