Lecture note for Analysis of Algorithm revised