Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Collections and Iterators in C++

Collections

  1. Prefer std::deque to std::vector when the size of the collection is unknow.

  2. Suppose set A and B are two set with the same type and set C is another set with the same value type but a different comparison function, then it is still valid to insert …

Probability to Lose All Money

A few days ago I found someone asking an interview questions on mitbbs. The question is as follows. A gambler plays a fair game and bet 1 dollar each time. If he lose all his money, the game stops. Suppose he has 10 dollars and is only allowed to play …