Python Strings

When you make a string in Python, but the string shall look like multiple lines in the source code, the following doesn’t work: [more]

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, and , performing Bernoulli trials and alternately, with occurance probabilities and respectively. Player 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]