Collection of some basic algorithms