alagorithm sample implemented