Some useful codes. (Algorithms implementations etc..)