Energy efficient algorithm