Floyd's cycle-finding algorithm

A well-known interview question: How to determine if a linked-list has a loop? The answer is to have two pointers scanning the linked-list. If the linked-list doesn’t contain any loop, we should be able to find the end of the linked-list. If the linked-list does contain a loop, then with... [more]

Hackintosh on Mountain Lion

To prepare for evacuation from my current work location, I decided to polish the computer that I intended to bring it back home. I got a Western Digital 3TB hard disk and want to install Mountain Lion on it. [more]

Game of Probability

In a game, two players, \(A\) and \(B\), performing Bernoulli trials \(t_A\) and \(t_B\) alternately, with occurance probabilities \(p_A\) and \(p_B\) respectively. Player \(A\) make his turn first. The game ends whenever a player succeed in his trial but continues if neither wins. [more]

Object Oriented Design

Object-oriented programming is easy. You just need to know how to use the “class” keyword in C++ and you’re done. It takes an hour to learn, at most two. [more]